<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <meta name="theme-color" content="#3367D6"/>
  <link rel="apple-touch-icon" href="/icons-192.png">
  <link rel="manifest" href="/manifest.json">
  <link rel="stylesheet" href="/lib/google-code-prettify/themes/tomorrow-night.css">
  <script type="text/javascript" src="/lib/google-code-prettify/src/prettify.js"></script>
  
  <meta name="generator" content="Hexo 5.4.2">

  
    <meta name="description" content="觉宇宙之无穷，识盈虚之有数">
  

  

  
    <meta name="author" content="RocPengHua">
  

  

  

  <title>杂乱无章.md | 小鹏驿站</title>

  

  
    <link rel="shortcut icon" href="/favicon.ico">
  

  

  
<link rel="stylesheet" href="/css/style.css">

</head>
<body onload="PR.prettyPrint()">
  <div class="root-container">
    
<!-- header container -->
<header class="header-container post">
  
    <div class="post-image" style="background-image: url(&#39;https://api.lixingyong.com/api/images?postid=a7bc184c&amp;type=url&amp;itype=image&#39;)"></div>
  
  <!-- navbar -->
<nav class="navbar">
  <div class="navbar-content">
    <!-- logo -->
    <div class="navbar-logo">
      <a href="/">
        
          小鹏驿站
        
      </a>
    </div>
    <!-- link -->
    <div class="navbar-link">
      <div class="navbar-btn">
        <div></div>
        <div></div>
        <div></div>
      </div>
      <ul class="navbar-list">
        
              <li class="navbar-list-item">
                <a href="/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-home faa-shake" aria-hidden="true"></i>
                    首页
                  </span>
                </a>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/archives">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-archive faa-shake" aria-hidden="true"></i>
                    归档
                  </span>
                </a>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/categories">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-folder faa-shake" aria-hidden="true"></i>
                    分类
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/categories/%E5%90%8E%E7%AB%AF/">
                          <i class="fa fa-etsy" aria-hidden="true"></i>
                          后端
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E5%89%8D%E7%AB%AF/">
                          <i class="fa fa-grav" aria-hidden="true"></i>
                          前端
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E8%BD%AF%E4%BB%B6/">
                          <i class="fa fa-key" aria-hidden="true"></i>
                          软件
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E7%AE%97%E6%B3%95/">
                          <i class="fa fa-glass" aria-hidden="true"></i>
                          算法
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/">
                          <i class="fa fa-database" aria-hidden="true"></i>
                          数据库
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E4%B8%AD%E9%97%B4%E4%BB%B6/">
                          <i class="fa fa-arrows-alt" aria-hidden="true"></i>
                          中间件
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E9%97%AE%E9%A2%98/">
                          <i class="fa fa-telegram" aria-hidden="true"></i>
                          问题
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/%E9%97%B2%E8%B0%88/">
                          <i class="fa fa-vcard" aria-hidden="true"></i>
                          闲谈
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/tags">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-tags" aria-hidden="true"></i>
                    标签
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/tags/%E5%8A%A0%E5%AF%86/">
                          <i class="fa fa-wpexplorer" aria-hidden="true"></i>
                          加密
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/idea/">
                          <i class="fa fa-eercast" aria-hidden="true"></i>
                          idea
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/java/">
                          <i class="fa fa-coffee" aria-hidden="true"></i>
                          java
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/mysql/">
                          <i class="fa fa-database" aria-hidden="true"></i>
                          mysql
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/oracle/">
                          <i class="fa fa-database" aria-hidden="true"></i>
                          oracle
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/spring/">
                          <i class="fa fa-leaf" aria-hidden="true"></i>
                          spring
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/redis/">
                          <i class="fa fa-fire" aria-hidden="true"></i>
                          redis
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/mongodb/">
                          <i class="fa fa-database" aria-hidden="true"></i>
                          mongodb
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/rocketmq/">
                          <i class="fa fa-random" aria-hidden="true"></i>
                          rocketmq
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/kafka/">
                          <i class="fa fa-random" aria-hidden="true"></i>
                          kafka
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/music">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-music" aria-hidden="true"></i>
                    音乐
                  </span>
                </a>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/links">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-link" aria-hidden="true"></i>
                    友链
                  </span>
                </a>
                
              </li>
            
              <li class="navbar-list-item">
                <a href="/about">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-signing" aria-hidden="true"></i>
                    关于
                  </span>
                </a>
                
              </li>
            
      </ul>
    </div>
  </div>
</nav>

  
  <span class="local-search local-search-google local-search-plugin" style="left: calc(50% - 200px);top: 0px;;position:absolute;z-index:2;">
      <input type="search" placeholder="小鹏驿站" id="local-search-input" class="local-search-input-cls" style="">
      <div id="local-search-result" class="local-search-result-cls"></div>
  </span>


  
  

  
  

  
  

  
  

  
  
    <div class="header-content">
      <div class="post-text layout-block">
        <div class="layout-margin">
          <h1 class="title-wrap" title="觉宇宙之无穷，识盈虚之有数">杂乱无章.md</h1>
          <h2 class="title-sub-wrap">
            <strong>RocPengHua</strong>
            <span>发布于</span>
            <time  class="article-date" datetime="2021-08-31T08:12:58.000Z" itemprop="datePublished">2021-08-31</time>
          </h2>
          <ul class="wrap-list dark">
  
    <li><a href="/categories/%E9%97%B2%E8%B0%88/">📒 闲谈</a></li>
  
</ul>
          <ul class="wrap-list dark">
  
</ul>
        </div>
      </div>
    </div>
  

  
  
  
</header>

    <!-- 文章 -->

<!-- 文章内容 -->
<div class="body-container">
  <article class="content-container layout-block post-container">
    <div class="widget-info">
      <section class="widget-author widget-item layout-margin content-padding--primary soft-size--large soft-style--box">
  <div class="widget-body">
    
      <img src="/images/p.jpg" class="soft-size--round soft-style--box" alt="RocPengHua">
    
    
      <h2>RocPengHua</h2>
    
    
      <p>天天向上</p>
    

    <div class="count-box">
      <div class="count-box--item">
        <svg class="icon icon-article" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M240.51564747 647.74217627h196.07203239c16.59071043 0 30.16492806-13.57421762 30.16492805-30.16492806V165.10332731c0-33.18142087-30.16492806-60.32985613-60.32985612-60.32985611H245.04038668C225.43318342 104.7734712 210.35071939 119.85593522 210.35071939 139.46313845V617.57724821c0 16.59071043 13.57421762 30.16492806 30.16492808 30.16492806z m663.62841731-452.47392089v482.63884894c0 33.18142087-27.14843525 60.32985613-60.32985612 60.32985613H180.18579134c-33.18142087 0-60.32985613-27.14843525-60.32985612-60.32985613V195.26825538c-49.77213131 0-90.49478418 40.72265287-90.49478417 90.49478417v452.4739209c0 49.77213131 40.72265287 90.49478418 90.49478417 90.49478417h286.56681657c16.59071043 0 30.16492806 13.57421762 30.16492807 30.16492807s13.57421762 30.16492806 30.16492805 30.16492806h90.49478418c16.59071043 0 30.16492806-13.57421762 30.16492805-30.16492806s13.57421762-30.16492806 30.16492807-30.16492807h286.56681657c49.77213131 0 90.49478418-40.72265287 90.49478417-90.49478417V285.76303955c0-49.77213131-40.72265287-90.49478418-90.49478417-90.49478417zM587.41232014 647.74217627h191.54729318c19.60720323 0 34.68966726-15.08246403 34.68966729-34.68966727V134.93839925c0-16.59071043-13.57421762-30.16492806-30.16492808-30.16492805H617.57724821c-30.16492806 0-60.32985613 27.14843525-60.32985612 60.32985611v452.4739209c0 16.59071043 13.57421762 30.16492806 30.16492805 30.16492806z" fill="currentColor"></path>
</svg>
        <span>118</span>
      </div>
      <div class="count-box--item">
        <svg class="icon icon-categories" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M900.3614811 257.09082106h-339.81629553l-67.96326003-101.9448889c-19.41807444-29.12711113-48.54518557-43.69066667-82.52681443-43.69066667H123.6385189c-53.39970333 0-97.09036999 43.69066667-97.09037113 97.09036999v582.54222222c0 53.39970333 43.69066667 97.09036999 97.09037113 97.09037002h776.7229622c53.39970333 0 97.09036999-43.69066667 97.09037113-97.09037002V354.18119104c0-53.39970333-43.69066667-97.09036999-97.09037113-97.09036998z m-97.09036999 242.72592554H220.72888889c-24.27259221 0-48.54518557-24.27259221-48.54518556-48.54518556s24.27259221-48.54518557 48.54518556-48.54518444h582.54222222c24.27259221 0 48.54518557 24.27259221 48.54518556 48.54518444s-24.27259221 48.54518557-48.54518556 48.54518556z" fill="currentColor"></path>
</svg>
        16
      </div>
      <div class="count-box--item">
        <svg class="icon icon-tags" viewBox="0 0 1098 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M283.42180005 272q0-28.38857157-20.09142843-48.48000001t-48.47999998-20.09142842-48.48000002 20.09142842-20.09142846 48.48000001 20.09142846 48.48 48.48000002 20.09142843 48.47999998-20.09142843 20.09142843-48.48zM855.0332285 580.57142843q0 28.38857157-19.81714313 48.2057147l-263.03999997 263.58857157q-20.9142853 19.81714313-48.75428534 19.81714312-28.38857157 0-48.20571468-19.81714312l-383.04-383.58857157q-20.36571468-19.81714313-34.55999999-54.10285688t-14.19428534-62.6742853l0-222.85714313q0-27.84000002 20.36571469-48.20571469t48.2057147-20.36571466l222.85714313 0q28.38857157 0 62.6742853 14.19428529t54.65142842 34.55999999l383.04000001 382.49142843q19.81714313 20.9142853 19.81714314 48.75428532zM1060.74751475 580.57142843q0 28.38857157-19.81714313 48.2057147l-263.04 263.58857157q-20.9142853 19.81714313-48.75428531 19.81714312-19.26857155 0-31.61142843-7.47428531t-28.38857159-24.13714314l251.79428534-251.7942853q19.81714313-19.81714313 19.81714308-48.20571469 0-27.84000002-19.81714308-48.75428531l-383.04000001-382.49142845q-20.36571468-20.36571468-54.65142842-34.55999999t-62.67428532-14.19428534l120 0q28.38857157 0 62.67428532 14.19428534t54.65142842 34.55999999l383.03999998 382.49142845q19.81714313 20.9142853 19.81714314 48.75428531z" fill="currentColor"></path>
</svg>
        40
      </div>
    </div>
  </div>
</section>
      
      
      
      
<section class="widget-toc widget-item layout-margin content-padding--primary soft-size--large soft-style--box">
  <div class="widget-title">
    <svg class="icon icon-toc" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M134.50666666 767.46666668H460.8c27.73333333 0 50.24000001 22.50666668 50.24000001 50.23999999v50.13333333c0 27.73333333-22.50666668 50.24000001-50.24000001 50.24000001H134.50666666c-27.73333333 0-50.24000001-22.50666668-50.23999999-50.24000001v-50.13333333c0.10666668-27.73333333 22.50666668-50.24000001 50.24000001-50.24000001zM84.37333332 541.65333333h326.18666669c27.73333333 0 50.24000001 22.39999999 50.23999999 50.13333334v50.24000001c0 27.73333333-22.50666668 50.24000001-50.24000002 50.23999999H84.37333332c-27.73333333 0-50.24000001-22.50666668-50.23999999-50.23999999v-50.24000001c0-27.73333333 22.50666668-50.13333334 50.24000001-50.13333334zM134.50666666 315.83999999H460.8c27.73333333 0 50.24000001 22.50666668 50.24000001 50.24000001v50.24000001c0 27.73333333-22.50666668 50.13333334-50.24000001 50.13333333H134.50666666c-27.73333333 0-50.24000001-22.39999999-50.23999999-50.13333333v-50.24000001c0.10666668-27.84000001 22.50666668-50.24000001 50.24000001-50.23999999zM209.81333332 89.91999999h326.18666671c27.73333333 0 50.24000001 22.39999999 50.23999997 50.13333335v50.23999999c0 27.73333333-22.50666668 50.24000001-50.24000001 50.24000001H209.81333332c-27.73333333 0-50.24000001-22.50666668-50.23999999-50.24000001v-50.24000001c0-27.73333333 22.50666668-50.13333334 50.24000001-50.13333333zM692.05333333 623.36l274.66666669 176.00000002c23.36000001 14.93333333 30.08 45.97333334 15.14666666 69.33333332L954.77333334 910.93333333c-14.93333333 23.25333334-45.97333334 30.08-69.33333335 15.14666667l-274.66666666-176c-23.36000001-14.93333333-30.08-45.97333334-15.14666667-69.33333333l27.09333334-42.24000001c14.93333333-23.36000001 46.08000001-30.08 69.33333333-15.14666666z" fill="currentColor"></path>
</svg>
    <span>TOC</span>
  </div>
  <div class="widget-body">
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E5%9C%A8js%E9%87%8C%E9%9D%A2%E5%BC%95%E5%85%A5js%E6%88%96css"><span class="toc-number">1.</span> <span class="toc-text">一、在js里面引入js或css</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C%E3%80%81%E8%87%AA%E5%AE%9A%E4%B9%89confirm"><span class="toc-number">2.</span> <span class="toc-text">二、自定义confirm</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81javascript%E9%83%A8%E5%88%86"><span class="toc-number">2.1.</span> <span class="toc-text">1、javascript部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81css%E9%83%A8%E5%88%86"><span class="toc-number">2.2.</span> <span class="toc-text">2、css部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E8%B0%83%E7%94%A8%E6%96%B9%E5%BC%8F"><span class="toc-number">2.3.</span> <span class="toc-text">3、调用方式</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%89%E3%80%81%E5%B8%B8%E7%94%A8%E7%9A%84js%E6%96%B9%E6%B3%95"><span class="toc-number">3.</span> <span class="toc-text">三、常用的js方法</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%9B%E3%80%81java%E9%87%8C%E9%9D%A2%E4%B8%80%E4%BA%9B%E6%97%A5%E6%9C%9F%E5%A4%84%E7%90%86%E6%96%B9%E6%B3%95"><span class="toc-number">4.</span> <span class="toc-text">四、java里面一些日期处理方法</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%94%E3%80%81oracle-SQL%E5%B0%8F%E6%8A%80%E5%B7%A7"><span class="toc-number">5.</span> <span class="toc-text">五、oracle SQL小技巧</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81megre-into"><span class="toc-number">5.1.</span> <span class="toc-text">1、megre into</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E8%BF%9E%E7%BB%AD%E5%89%8D%E5%87%A0%E5%91%A8%E8%BF%9E%E7%BB%AD%E7%9A%84%E5%91%A8%E6%97%A5%E6%9C%9F%E6%95%B0%E6%8D%AE-2019W14-2019W25"><span class="toc-number">5.2.</span> <span class="toc-text">2、连续前几周连续的周日期数据(2019W14-2019W25)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E8%8E%B7%E5%8F%96%E5%89%8D%E5%87%A0%E5%A4%A9%E7%9A%84%E5%A4%A9%E6%97%A5%E6%9C%9F%E6%95%B0%E6%8D%AE"><span class="toc-number">5.3.</span> <span class="toc-text">3、获取前几天的天日期数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81%E8%8E%B7%E5%8F%96%E5%89%8D%E5%87%A0%E4%B8%AA%E6%9C%88%E7%9A%84%E6%9C%88%E6%97%A5%E6%9C%9F%E6%95%B0%E6%8D%AE"><span class="toc-number">5.4.</span> <span class="toc-text">4、获取前几个月的月日期数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5%E3%80%81%E8%8E%B7%E5%8F%96%E6%9C%80%E8%BF%9124%E5%B0%8F%E6%97%B6%E6%95%B0%E6%8D%AE"><span class="toc-number">5.5.</span> <span class="toc-text">5、获取最近24小时数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6%E3%80%81%E5%AD%97%E7%AC%A6%E4%B8%B2%E2%80%99aaa-bbb-ccc%E2%80%99%E8%BD%AC%E8%A1%A8%E6%95%B0%E6%8D%AE%E2%80%99aaa%E2%80%99-%E2%80%99bbb%E2%80%99-%E2%80%99ccc%E2%80%99"><span class="toc-number">5.6.</span> <span class="toc-text">6、字符串’aaa,bbb,ccc’转表数据’aaa’,’bbb’,’ccc’</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7%E3%80%81Oracle%E4%B8%ADrank-over-dense-rank-row-number-%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-number">5.7.</span> <span class="toc-text">7、Oracle中rank() over, dense_rank(), row_number() 的区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8%E3%80%81group-by-%E4%B8%8E-partition-by-%E5%8C%BA%E5%88%AB"><span class="toc-number">5.8.</span> <span class="toc-text">8、group by 与 partition by 区别</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9%E3%80%81DDL"><span class="toc-number">5.9.</span> <span class="toc-text">9、DDL</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10%E3%80%81plsq%E6%B3%A8%E5%86%8C%E7%A0%81"><span class="toc-number">5.10.</span> <span class="toc-text">10、plsq注册码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11%E3%80%81%E8%A1%8C%E8%BD%AC%E5%88%97"><span class="toc-number">5.11.</span> <span class="toc-text">11、行转列</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12%E3%80%81%E6%A0%B9%E6%8D%AE%E6%9F%90%E4%B8%80%E4%B8%AA%E5%AD%97%E6%AE%B5%E6%8E%92%E5%BA%8F%E8%8E%B7%E5%8F%96%E5%BA%8F%E5%8F%B7"><span class="toc-number">5.12.</span> <span class="toc-text">12、根据某一个字段排序获取序号</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13%E3%80%81%E6%A0%B9%E6%8D%AE%E6%9F%90%E4%B8%80%E4%B8%AA%E5%AD%97%E6%AE%B5%E8%8E%B7%E5%8F%96%E6%95%B0%E9%87%8F"><span class="toc-number">5.13.</span> <span class="toc-text">13、根据某一个字段获取数量</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#14%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93%E8%B5%8B%E6%9D%83"><span class="toc-number">5.14.</span> <span class="toc-text">14、数据库赋权</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%AD%E3%80%81css"><span class="toc-number">6.</span> <span class="toc-text">六、css</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81google%E6%B5%8F%E8%A7%88%E5%99%A8%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E9%A2%9C%E8%89%B2"><span class="toc-number">6.1.</span> <span class="toc-text">1、google浏览器自动填充颜色</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E6%BB%9A%E5%8A%A8%E6%9D%A1%E6%94%B9%E9%80%A0"><span class="toc-number">6.2.</span> <span class="toc-text">2、滚动条改造</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81select%E4%B8%8B%E6%8B%89%E6%A1%86%E6%94%B9%E9%80%A0"><span class="toc-number">6.3.</span> <span class="toc-text">3、select下拉框改造</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%83%E3%80%81mysql"><span class="toc-number">7.</span> <span class="toc-text">七、mysql</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81this-is-incompatible-with-sql-mode-x3D-only-full-group-by"><span class="toc-number">7.1.</span> <span class="toc-text">1、this is incompatible with sql_mode&#x3D;only_full_group_by</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E6%97%A5%E6%9C%9F%E8%8E%B7%E5%8F%96"><span class="toc-number">7.2.</span> <span class="toc-text">2、日期获取</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E8%BD%AC%E5%8C%96%E6%88%90%E6%95%B0%E5%AD%97%E6%8E%92%E5%BA%8F"><span class="toc-number">7.3.</span> <span class="toc-text">3、转化成数字排序</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81CSV%E6%96%87%E4%BB%B6%E5%AF%BC%E5%85%A5%E6%95%B0%E6%8D%AE"><span class="toc-number">7.4.</span> <span class="toc-text">4、CSV文件导入数据</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5%E3%80%81%E5%89%8D2%E4%B8%AA%E6%9C%88"><span class="toc-number">7.5.</span> <span class="toc-text">5、前2个月</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6%E3%80%81%E5%89%8D30%E5%A4%A9%E6%95%B0%E6%8D%AE"><span class="toc-number">7.6.</span> <span class="toc-text">6、前30天数据</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%AB%E3%80%81nginx"><span class="toc-number">8.</span> <span class="toc-text">八、nginx</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81win%E5%90%AF%E5%8A%A8"><span class="toc-number">8.1.</span> <span class="toc-text">1、win启动</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E7%AE%80%E5%8D%95%E9%85%8D%E7%BD%AE"><span class="toc-number">8.2.</span> <span class="toc-text">2、简单配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B9%9D%E3%80%81javascript"><span class="toc-number">9.</span> <span class="toc-text">九、javascript</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E5%8F%98%E5%8C%96title"><span class="toc-number">9.1.</span> <span class="toc-text">1、变化title</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81js%E5%AE%9E%E7%8E%B0%E6%A8%A1%E6%80%81%E6%A1%86%E6%8B%96%E6%8B%BD"><span class="toc-number">9.2.</span> <span class="toc-text">3、js实现模态框拖拽</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E5%AD%97%E7%AC%A6%E8%BD%AC%E4%B9%89"><span class="toc-number">9.3.</span> <span class="toc-text">3、字符转义</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81js%E5%85%B3%E9%97%AD%E9%A1%B5%E9%9D%A2"><span class="toc-number">9.4.</span> <span class="toc-text">4、js关闭页面</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5%E3%80%81div%E6%BB%9A%E5%8A%A8%E6%92%AD%E6%94%BE"><span class="toc-number">9.5.</span> <span class="toc-text">5、div滚动播放</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E3%80%81redis"><span class="toc-number">10.</span> <span class="toc-text">十、redis</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E6%9F%A5%E7%9C%8B%E8%BF%9E%E6%8E%A5%E6%95%B0"><span class="toc-number">10.1.</span> <span class="toc-text">1、查看连接数</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%B8%80%E3%80%81%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F"><span class="toc-number">11.</span> <span class="toc-text">十一、正则表达式</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E9%98%B6%E6%AE%B5%E6%9B%BF%E6%8D%A2"><span class="toc-number">11.1.</span> <span class="toc-text">1、阶段替换</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8D%81%E4%BA%8C%E3%80%81cron%E8%8C%83%E4%BE%8B"><span class="toc-number">12.</span> <span class="toc-text">十二、cron范例</span></a></li></ol>
  </div>
</section>

    </div>
  
    <div class="article-info">
      
      
      
      
      <section id="blog-content" class="article-entry markdown-body layout-margin content-padding--large soft-size--large soft-style--box">
        <h2 id="一、在js里面引入js或css"><a href="#一、在js里面引入js或css" class="headerlink" title="一、在js里面引入js或css"></a>一、在js里面引入js或css</h2><pre><code class="javascript">//论坛首页 各模块铁贴数
var new_element=document.createElement(&quot;script&quot;);
new_element.setAttribute(&quot;type&quot;,&quot;text/javascript&quot;);
new_element.setAttribute(&quot;src&quot;,&quot;../prompt/prompt.js&quot;);// 在这里引入了a.js
document.body.appendChild(new_element);
function loadStyle(url)&#123;
    var link = document.createElement(&#39;link&#39;);
        link.type = &#39;text/css&#39;;
        link.rel = &#39;stylesheet&#39;;
        link.href = url;
        var head = document.getElementsByTagName(&#39;head&#39;)[0];
        head.appendChild(link);
    &#125;
loadStyle(&#39;../prompt/prompt.css&#39;);
</code></pre>
<h2 id="二、自定义confirm"><a href="#二、自定义confirm" class="headerlink" title="二、自定义confirm"></a>二、自定义confirm</h2><h3 id="1、javascript部分"><a href="#1、javascript部分" class="headerlink" title="1、javascript部分"></a>1、javascript部分</h3><pre><code class="prettyprint">function showPop(string,callback)&#123;
    function set()&#123;
        let popDom = &#39;&lt;div class=&quot;popUps_mask&quot;&gt;&#39;;
        popDom += &#39;&lt;div&gt;&#39;;
        popDom += &#39;&lt;div class=&quot;shutDown&quot;&gt;+&lt;/div&gt;&#39;;
        popDom += &#39;&lt;div class=&quot;theme&quot;&gt;&#39;+string+&#39;&lt;/div&gt;&#39;;
        popDom += &#39;&lt;div class=&quot;buttonList&quot;&gt;&lt;button class=&quot;cancel&quot;&gt;取消&lt;/button&gt;&lt;button class=&quot;confirm&quot;&gt;确认&lt;/button&gt;&lt;/div&gt;&#39;;
        popDom += &#39;&lt;/div&gt;&#39;;
        popDom += &#39;&lt;/div&gt;&#39;;
        $(&#39;body&#39;).append(popDom);
    &#125;
    set();
    $(&#39;.shutDown&#39;).click(function()&#123;
        $(&#39;.popUps_mask&#39;).remove();
    &#125;);
    $(&#39;.cancel&#39;).click(function()&#123;
        $(&#39;.popUps_mask&#39;).remove();
    &#125;);
    $(&#39;.confirm&#39;).click(function()&#123;
        callback&amp;&amp;callback();
        $(&#39;.popUps_mask&#39;).remove();
    &#125;)
&#125;
</code></pre>
<h3 id="2、css部分"><a href="#2、css部分" class="headerlink" title="2、css部分"></a>2、css部分</h3><pre><code class="prettyprint">.popUps_mask&#123;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1024;
&#125;

.popUps_mask &gt;div&#123;
    width: 350px;
    box-shadow: 0px 0px 7px #8e8787;
    height: 210px;
    background: white;
    margin: 10% auto;
    position: relative;
&#125;

.popUps_mask &gt;div .shutDown&#123;
    font-size: 35px;
    position: absolute;
    top: -4px;
    right: 7px;
    color: #d6d0d0;
    transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    cursor: pointer;
&#125;    

.popUps_mask &gt;div .theme&#123;
    text-align: center;
    font-size: 25px;
    color: black;
    padding-top: 60px;
&#125;    

.popUps_mask &gt;div .buttonList&#123;
    text-align: center;
    margin-top: 35px;
&#125;    

.popUps_mask &gt;div .buttonList .cancel&#123;
    width: 70px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    height: 30px;
    background: #f8f8f8;
&#125;

.popUps_mask &gt;div .buttonList .cancel&#123;
    width: 70px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    height: 30px;
    background: #f8f8f8;
    margin-right: 5px;
    cursor: pointer;
&#125;

.popUps_mask &gt;div .buttonList .confirm&#123;
    width: 70px;
    border: 1px solid #277BAD;
    border-radius: 4px;
    height: 30px;
    background: white;
    color: #277BAD;
    margin-left: 5px;
    cursor: pointer;
&#125;
</code></pre>
<h3 id="3、调用方式"><a href="#3、调用方式" class="headerlink" title="3、调用方式"></a>3、调用方式</h3><pre><code class="prettyprint">showPop(&quot;是否确认删除！&quot;,
        function()&#123;
                //doSomething
        &#125;)
</code></pre>
<h2 id="三、常用的js方法"><a href="#三、常用的js方法" class="headerlink" title="三、常用的js方法"></a>三、常用的js方法</h2><pre><code class="prettyprint">// 日期格式化
Date.prototype.format = function (fmt) &#123;
    var o = &#123;
        &quot;y+&quot;: this.getYear(),
        &quot;M+&quot;: this.getMonth() + 1, //月份 
        &quot;d+&quot;: this.getDate(), //日 
        &quot;h+&quot;: this.getHours(), //小时 
        &quot;m+&quot;: this.getMinutes(), //分 
        &quot;s+&quot;: this.getSeconds(), //秒 
        &quot;q+&quot;: Math.floor((this.getMonth() + 3) / 3), //季度 
        &quot;S&quot;: this.getMilliseconds() //毫秒 
    &#125;;
    if (/(y+)/.test(fmt)) &#123;
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + &quot;&quot;).substr(4 - RegExp.$1.length));
    &#125;
    for (var k in o)&#123;
        if (new RegExp(&quot;(&quot; + k + &quot;)&quot;).test(fmt))&#123;
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((&quot;00&quot; + o[k]).substr((&quot;&quot; + o[k]).length)));
        &#125;
    &#125;
    return fmt;
&#125;
var commonUtils = &#123;
        sleep:function(numberMillis)&#123;
             var now = new Date();
                var exitTime = now.getTime() + numberMillis;
                while (true) &#123;
                    now = new Date();
                    if (now.getTime() &gt; exitTime)
                        return;
                &#125;
        &#125;,
        round:function(src,pos)&#123;
            if(typeof src !==&#39;number&#39;)&#123;
                src = parseFloat(src);
                if(isNaN(src))&#123;
                    src = 0;
                &#125;
            &#125;
            if(!pos)&#123;
                pos = 2;
            &#125;
            return (Math.round(src*Math.pow(10, pos))/Math.pow(10, pos)).toFixed(pos);
        &#125;,
        
        booleanValueOf:function(value)&#123;
            if(value==true || /^true$/ig.test(value))&#123;
                return true;
            &#125;else&#123;
                return false;
            &#125;
        &#125;,
        getLength:function(object) &#123;
            var count = 0;
            for(var i in object) count++;
            return count;
        &#125;,
        isObject: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Object]&quot;;
        &#125;,
        isArray: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Array]&quot;;
        &#125;,
        isFunction: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Function]&quot;;
        &#125;,
        isBoolean: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Boolean]&quot;;
        &#125;,
        isNumber: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Number]&quot;;
        &#125;,
        isString: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object String]&quot;;
        &#125;,
        isUndefined: function(obj)&#123;
            return Object.prototype.toString.call(obj) === &quot;[object Undefined]&quot;;
        &#125;,
        isEmpty: function(obj)&#123;
            if(obj == null || obj == &#39;undefined&#39; || obj == undefined || obj.length==0)&#123;
                return true;
            &#125;else&#123;
                return false;
            &#125;
            
        &#125;,
        //设置百分率
        setRate: function (data)&#123;
            data = data +&quot;&quot;;
            return data.indexOf(&quot;NaN&quot;) != - 1?&quot;0.00&quot;:parseFloat(data).toFixed(2)+&quot;&quot;;
        &#125;,
        //去除空格
        trim: function (str)&#123; 
            
          return String(str).replace(/(^\s*)|(\s*$)/g, &quot;&quot;); 
        &#125;,
        /**
         * 计算输入值得最小整数值
         * @param &#123;Object&#125; val
         */
        getYMinVal : function(min,max)&#123;
            if((min + Math.abs(min)) != 0)&#123;
                var minS = &quot;&quot;;
                var minC = min+&quot;&quot;;
                if(minC.indexOf(&quot;.&quot;) != -1 &amp;&amp; &quot;0&quot; == (minC.substring(0,minC.indexOf(&quot;.&quot;))))&#123;
                    if(max &lt;3)&#123;
                        minS =  minC.substring(0,minC.indexOf(&quot;.&quot;)+2);
                    &#125;else&#123;
                        minS = &quot;0&quot;;
                    &#125;
                &#125;else &#123;
                	if(minC.indexOf(&quot;.&quot;)!=-1)&#123;
                		if(max &lt; 5)&#123;
                			minS = ((minC * 0.98)+&quot;&quot;).substring(0,((minC * 0.98)+&quot;&quot;).indexOf(&quot;.&quot;)+2)
                		&#125;else if(max &lt; 10)&#123;
                			minS = ((minC * 0.95)+&quot;&quot;).substring(0,((minC * 0.95)+&quot;&quot;).indexOf(&quot;.&quot;)+2)
                		&#125;else if(max &lt; 20)&#123;
                			minS = ((minC * 0.9)+&quot;&quot;).substring(0,((minC * 0.9)+&quot;&quot;).indexOf(&quot;.&quot;)+2)
                		&#125;else&#123;
                			minS = minC.substring(0,minC.indexOf(&quot;.&quot;));
                			if(minS.length == 1)&#123;
                                if(max &gt; 30)&#123;
                                    minS = &quot;0&quot;;
                                &#125;
                            &#125;else if(minS.length &lt; 3)&#123;
                                var zeros = &quot;&quot;;
                                for(var i=0;i&lt;minS.length-1;i++)&#123;
                                    zeros += &quot;0&quot;;
                                &#125;
                                minS = minS.substring(0,1)+zeros;
                            &#125;else&#123;
                                var zeros = &quot;&quot;;
                                for(var i=0;i&lt;minS.length-2;i++)&#123;
                                    zeros += &quot;0&quot;;
                                &#125;
                                minS = minS.substring(0,2)+zeros;
                            &#125;
                		&#125;
                	&#125;else&#123;
                		minS = minC;
                		if(minS.length == 1)&#123;
                            if(max &lt; 30)&#123;
                                minCS = &quot;0&quot;;
                            &#125;
                        &#125;else if(minS.length &lt;= 3)&#123;
                            var zeros = &quot;&quot;;
                            for(var i=0;i&lt;minS.length-1;i++)&#123;
                                zeros += &quot;0&quot;;
                            &#125;
                            minS = minS.substring(0,1)+zeros;
                        &#125;else&#123;
                            var zeros = &quot;&quot;;
                            for(var i=0;i&lt;minS.length-2;i++)&#123;
                                zeros += &quot;0&quot;;
                            &#125;
                            minS = minS.substring(0,2)+zeros;
                        &#125;
                	&#125;
                &#125;

                return minS.indexOf(&quot;.&quot;) != -1?parseFloat(minS):parseInt(minS);
            &#125;
            
            if(isNaN(min) || min==0)&#123;
                return 0;
            &#125;
            if(max-min&lt;=5)&#123;
                return Math.floor(min);
            &#125;
            
            var t_val = Math.abs(min);
            var temp = 0;
            
            if(t_val&lt;100)&#123;
                temp = Math.floor((min)/5)*5;
            &#125;else if(t_val&gt;=100 &amp;&amp; t_val&lt;1000)&#123;
                temp = Math.floor((min)/50)*50;
            &#125;else if(t_val&gt;=1000 &amp;&amp; t_val&lt;10000)&#123;
                temp = Math.floor((min)/500)*500;
            &#125;else if(t_val&gt;=10000 &amp;&amp; t_val&lt;100000)&#123;
                temp = Math.floor((min)/5000)*5000;
            &#125;else if(t_val&gt;=100000)&#123;
                temp = Math.floor((min)/50000)*50000;
            &#125;
            if(min&gt;0 &amp;&amp; max&gt;0 &amp;&amp; temp&lt;0)&#123;
                return 0;
            &#125;else&#123;
                return temp;
            &#125;
        &#125;,
        getIndexWithArr: function(_arr,_obj) &#123;
            var len = _arr.length;
            for(var i = 0; i &lt; len; i++)
            &#123;
                if(_arr[i] == _obj)
                &#123;
                    return parseInt(i);
                &#125;
            &#125;
            return -1;
        &#125;,
        removeObjWithArr :function (_arr,_obj) &#123;
            var length = _arr.length;
            for(var i = 0; i &lt; length; i++)&#123;
                if(_arr[i] == _obj)&#123;
                	return _arr.splice(i,1);
                    if(i == 0)&#123;
                        _arr.shift(); //删除并返回数组的第一个元素
                        return;
                    &#125;else if(i == length-1)&#123;
                        _arr.pop();  //删除并返回数组的最后一个元素
                        return;
                    &#125;else&#123;
                    	return _arr.splice(i,1); //删除下标为i的元素
                        
                    &#125;
                &#125;
            &#125;
        &#125;,
        /*比较对象*/
        compare:function(objA, objB) &#123;
            var flag = true;
            if(!commonUtils.isObject(objA) || !commonUtils.isObject(objB))&#123;
            	flag = false; //判断类型是否正确
            &#125;
            if(commonUtils.getLength(objA) != commonUtils.getLength(objB))&#123;
            	flag = false; //判断长度是否一致
            &#125;
            for(var key in objA) &#123;
                if(!flag) //跳出整个循环
                    break;
                if(!objB.hasOwnProperty(key)) &#123;
                    flag = false;
                    break;
                &#125;
                if(!commonUtils.isArray(objA[key])) &#123; //子级不是数组时,比较属性值
                    if(objB[key] != objA[key]) &#123;
                        flag = false;
                        break;
                    &#125;
                &#125; else &#123;
                    if(!commonUtils.isArray(objB[key])) &#123;
                        flag = false;
                        break;
                    &#125;
                    var oA = objA[key],
                        oB = objB[key];
                    if(oA.length != oB.length) &#123;
                        flag = false;
                        break;
                    &#125;
                    for(var k in oA) &#123;
                        if(!flag) //这里跳出循环是为了不让递归继续
                            break;
                        flag = CompareObj(oA[k], oB[k], flag);
                    &#125;
                &#125;
            &#125;
            return flag;
        &#125;
&#125;
</code></pre>
<h2 id="四、java里面一些日期处理方法"><a href="#四、java里面一些日期处理方法" class="headerlink" title="四、java里面一些日期处理方法"></a>四、java里面一些日期处理方法</h2><pre><code class="prettyprint">public class DateUtils &#123;

    /**
     * 
     * 方法说明：获取当前日期最近的星期五 Author： PengP Create Date： 2018年7月27日 上午10:06:37
     * 如果是星期五获取上个星期五的数据
     * @param date
     *            日期 2018-7-27
     * @param format
     *            yyyy-MM-dd
     * @return
     * @throws ParseException
     */
    public static String getLastForWeekForInit(Date dateParam)&#123;
        SimpleDateFormat sdfDefault = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);
        Date date = null;
        try &#123;
            String yzTime = getTimeInterval(dateParam,&quot;yyyy-MM-dd&quot;);// 获取选中日期本周时间区间
            String array[] = yzTime.split(&quot;,&quot;);
            String startTime = array[0];// 本周第一天
            String endTime = array[1]; // 本周最后一天
            // 格式化日期
            Date dBegin = sdfDefault.parse(startTime);
            Date dEnd = sdfDefault.parse(endTime);
            List&lt;Date&gt; lDate = findDates(dBegin, dEnd);// 获取这周所有date
            if (lDate.get(4).getTime() &gt; dateParam.getTime() - 24 * 3600 * 1000) &#123;
                date = new Date(lDate.get(4).getTime() - 7 * 24 * 3600 * 1000);
            &#125;else&#123;
                date = lDate.get(4);
            &#125;
        &#125; catch (ParseException e) &#123;
            // TODO Auto-generated catch block
            e.printStackTrace();
        &#125;
        return sdfDefault.format(date);
    &#125;
    /**
     * 
     * 方法说明：获取当前日期最近的星期五
     * 如果是星期五获取这个星期五的数据
     * Author： PengP               
     * Create Date： 2018年8月2日 上午10:46:09
     * @param dateParam
     * @return
     */
    public static String getLastForWeek(Date dateParam)&#123;
        SimpleDateFormat sdfDefault = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);
        Date date = null;
        try &#123;
            String yzTime = getTimeInterval(dateParam,&quot;yyyy-MM-dd&quot;);// 获取选中日期本周时间区间
            String array[] = yzTime.split(&quot;,&quot;);
            String startTime = array[0];// 本周第一天
            String endTime = array[1]; // 本周最后一天
            // 格式化日期
            Date dBegin = sdfDefault.parse(startTime);
            Date dEnd = sdfDefault.parse(endTime);
            List&lt;Date&gt; lDate = findDates(dBegin, dEnd);// 获取这周所有date
            if (lDate.get(4).getTime() &gt; dateParam.getTime()) &#123;
                date = new Date(lDate.get(4).getTime() - 7 * 24 * 3600 * 1000);
            &#125;else&#123;
                date = lDate.get(4);
            &#125;
        &#125; catch (ParseException e) &#123;
            // TODO Auto-generated catch block
            e.printStackTrace();
        &#125;
        return sdfDefault.format(date);
    &#125;
    /**
     * 
     * 方法说明：获取当前日期最近的星期五 Author： PengP Create Date： 2018年7月27日 上午10:06:37
     * 今天星期五就上个星期五
     * @param date
     *            日期 2018-7-27
     * @param format
     *            yyyy-MM-dd
     * @return
     * @throws ParseException
     */
    public static String getLastForWeekForInit(String dateStr, String format)&#123;
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        try&#123;
            String yzTime = getTimeInterval(sdf.parse(dateStr),format);// 获取选中日期本周时间区间
            String array[] = yzTime.split(&quot;,&quot;);
            String startTime = array[0];// 本周第一天
            String endTime = array[1]; // 本周最后一天
            // 格式化日期
            Date dBegin = sdf.parse(startTime);
            Date dEnd = sdf.parse(endTime);
            List&lt;Date&gt; lDate = findDates(dBegin, dEnd);// 获取这周所有date
            if (lDate.get(4).getTime() &gt; sdf.parse(dateStr).getTime()-24 * 3600 * 1000) &#123;
                date = new Date(lDate.get(4).getTime() - 7 * 24 * 3600 * 1000);
            &#125;else&#123;
                date = lDate.get(4);
            &#125;
        &#125; catch (ParseException e) &#123;
            e.printStackTrace();
        &#125;
        return sdf.format(date);
    &#125;
    /**
     * 
     * 方法说明：获取当前日期最近的星期五 Author： PengP Create Date： 2018年7月27日 上午10:06:37
     * 今天星期五就星期五
     * @param date
     *            日期 2018-7-27
     * @param format
     *            yyyy-MM-dd
     * @return
     * @throws ParseException
     */
    public static String getLastForWeek(String dateStr, String format)&#123;
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        try&#123;
            String yzTime = getTimeInterval(sdf.parse(dateStr),format);// 获取选中日期本周时间区间
            String array[] = yzTime.split(&quot;,&quot;);
            String startTime = array[0];// 本周第一天
            String endTime = array[1]; // 本周最后一天
            // 格式化日期
            Date dBegin = sdf.parse(startTime);
            Date dEnd = sdf.parse(endTime);
            List&lt;Date&gt; lDate = findDates(dBegin, dEnd);// 获取这周所有date
            if (lDate.get(4).getTime() &gt; sdf.parse(dateStr).getTime()) &#123;
                date = new Date(lDate.get(4).getTime() - 7 * 24 * 3600 * 1000);
            &#125;else&#123;
                date = lDate.get(4);
            &#125;
        &#125; catch (ParseException e) &#123;
            e.printStackTrace();
        &#125;
        return sdf.format(date);
    &#125;
    /**
     * 
     * 方法说明：根据当前日期获得上个月月份  Author： HaoRanY Create Date： 2018年8月24日
     * 上午11:11:30
     * 
     * @param date
     * @return
     */
     public static String getLastMonthDate(Date dateParam) &#123;
         SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyyMM&quot;);
         Calendar c = Calendar.getInstance();
         c.setTime(dateParam);
         c.add(Calendar.MONTH, -1);
 
         return sdf.format(c.getTime());
     &#125;
     
    /**
     * 方法说明：根据当前日期获得上个月月份 
     * @author haokaih，2018年8月29日
     * @param dateParam date参数
     * @param format 以什么格式返回 如 &quot;yyyy-MM&quot;
     * @return 根据参数进行转化 如 &quot;2018-08&quot;
     */
    public static String getLastMonth(Date dateParam, String format) &#123;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Calendar c = Calendar.getInstance();
        c.setTime(dateParam);
        c.add(Calendar.MONTH, -1);
        return sdf.format(c.getTime());
    &#125;

    /**
     * 
     * 方法说明：根据当前日期获得所在周的日期区间（周一和周日日期） Author： PengP Create Date： 2018年7月27日
     * 上午10:20:30
     * 
     * @param date
     * @return
     */
    public static String getTimeInterval(Date date,String format) &#123;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        // 判断要计算的日期是否是周日，如果是则减一天计算周六的，否则会出问题，计算到下一周去了
        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天
        if (1 == dayWeek) &#123;
            cal.add(Calendar.DAY_OF_MONTH, -1);
        &#125;
        // System.out.println(&quot;要计算日期为:&quot; + sdf.format(cal.getTime())); // 输出要计算日期
        // 设置一个星期的第一天，按中国的习惯一个星期的第一天是星期一
        cal.setFirstDayOfWeek(Calendar.MONDAY);
        // 获得当前日期是一个星期的第几天
        int day = cal.get(Calendar.DAY_OF_WEEK);
        // 根据日历的规则，给当前日期减去星期几与一个星期第一天的差值
        cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
        String imptimeBegin = sdf.format(cal.getTime());
        // System.out.println(&quot;所在周星期一的日期：&quot; + imptimeBegin);
        cal.add(Calendar.DATE, 6);
        String imptimeEnd = sdf.format(cal.getTime());
        // System.out.println(&quot;所在周星期日的日期：&quot; + imptimeEnd);
        return imptimeBegin + &quot;,&quot; + imptimeEnd;
    &#125;
    public static String getLastForWeekForInit(String dateStr)&#123;
        return DateUtils.getLastForWeekForInit(dateStr, &quot;yyyy-MM-dd&quot;);
    &#125;
    public static String getLastForWeek(String dateStr)&#123;
        return DateUtils.getLastForWeek(dateStr, &quot;yyyy-MM-dd&quot;);
    &#125;
    /**
     * 
     * 方法说明：根据当前日期获得上周的日期区间（上周周一和周日日期） Author： PengP Create Date： 2018年7月27日
     * 上午10:20:13
     * 
     * @return
     */
    public static String getLastTimeInterval() &#123;
        SimpleDateFormat sdfDefault = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);
        Calendar calendar1 = Calendar.getInstance();
        Calendar calendar2 = Calendar.getInstance();
        int dayOfWeek = calendar1.get(Calendar.DAY_OF_WEEK) - 1;
        int offset1 = 1 - dayOfWeek;
        int offset2 = 7 - dayOfWeek;
        calendar1.add(Calendar.DATE, offset1 - 7);
        calendar2.add(Calendar.DATE, offset2 - 7);
        // System.out.println(sdf.format(calendar1.getTime()));// last Monday
        String lastBeginDate = sdfDefault.format(calendar1.getTime());
        // System.out.println(sdf.format(calendar2.getTime()));// last Sunday
        String lastEndDate = sdfDefault.format(calendar2.getTime());
        return lastBeginDate + &quot;,&quot; + lastEndDate;
    &#125;

    /**
     * 
     * 方法说明：获取一周开始到结束的list集合 Author： PengP Create Date： 2018年7月27日 上午10:19:37
     * 
     * @param dBegin
     *            开始日期
     * @param dEnd
     *            结束日期
     * @return
     */
    public static List&lt;Date&gt; findDates(Date dBegin, Date dEnd) &#123;
        List&lt;Date&gt; lDate = new ArrayList&lt;Date&gt;();
        lDate.add(dBegin);
        Calendar calBegin = Calendar.getInstance();
        // 使用给定的 Date 设置此 Calendar 的时间
        calBegin.setTime(dBegin);
        Calendar calEnd = Calendar.getInstance();
        // 使用给定的 Date 设置此 Calendar 的时间
        calEnd.setTime(dEnd);
        // 测试此日期是否在指定日期之后
        while (dEnd.after(calBegin.getTime())) &#123;
            // 根据日历的规则，为给定的日历字段添加或减去指定的时间量
            calBegin.add(Calendar.DAY_OF_MONTH, 1);
            lDate.add(calBegin.getTime());
        &#125;
        return lDate;
    &#125;
    /**
     * 
     * 方法说明：根据格式获取日期字符串
     * Author： PengP               
     * Create Date： 2018年7月27日 上午11:34:57
     * @param Date
     * @param format
     * @return
     */
    public static String getStrDate(Date date,String format)&#123;
        return new SimpleDateFormat(format).format(date);
    &#125;
    /**
     * 
     * 方法说明：根据默认格式获取日期字符串
     * Author： PengP               
     * Create Date： 2018年7月27日 上午11:36:48
     * @param date
     * @return
     */
    public static String getStrDate(Date date)&#123;
        return getStrDate(date, &quot;yyyy-MM-dd&quot;);
    &#125;

    /**
     * 获取指定日期(不包括指定日期)的前指定数量周日期数据
     * 日期参数和格式参数要一致，返回的格式也是由格式参数决定
     * @param dateStr 20180727
     * @param period 指定周期数
     * @param formatter yyyyMMdd
     * @return
     */
    public static List&lt;String&gt; getDateStrList(String dateStr, int period, String formatter) &#123;
        List&lt;String&gt; dateStrs = new ArrayList&lt;String&gt;();
        try &#123;
            SimpleDateFormat dateFormat = new SimpleDateFormat(formatter);
            Calendar calendar = Calendar.getInstance();
            Date date = dateFormat.parse(dateStr);
            calendar.setTime(date);
            for (int i = 1; i &lt; period; i++) &#123;
                calendar.add(Calendar.WEEK_OF_MONTH, -1);
                dateStrs.add(dateFormat.format(calendar.getTime()));
            &#125;
        &#125; catch (ParseException e) &#123;
            e.printStackTrace();
        &#125;
        return dateStrs;
    &#125;
    
    /**
     * 
     * 方法说明：获取传入时间的最近十二个月
     * Author：lve               
     * Create Date： 2018年8月24日 上午9:06:50
     * @param time 支持 2018-01的时间字符串格式
     * @return
     */
    public static List&lt;String&gt; getLast12Months(String time)&#123;  
        //处理月份输入条件
        if(time.length()==7)&#123;
            time=time+&quot;-01 00:00:00&quot;;
        &#125;else if(time.length()==110)&#123;
            time=time.substring(0,7)+&quot;-01 00:00:00&quot;;
        &#125;
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat(&quot;yyyy-MM-dd hh:mm:ss&quot;);  
        try &#123;
             date= sdf.parse(time);
        &#125; catch (ParseException e) &#123;
            return null;
        &#125; 
        
        Calendar cal = Calendar.getInstance();
        //设置输入条件时间
        cal.setTime(date);
        
        cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1); //要先+1,才能把本月的算进去
        List&lt;String&gt; list = new ArrayList&lt;String&gt;();
        for(int i=0; i&lt;11; i++)&#123; 
            cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)-1); //逐次往前推1个月  
            list.add(cal.get(Calendar.YEAR)+ &quot;&quot; + addZeroForNum(String.valueOf(cal.get(Calendar.MONTH)+1), 2));  
        &#125;  
        return list;  
    &#125;  
    /**
     * 
     * 方法说明：时间格式补0
     * Author： lve               
     * Create Date： 2018年8月24日 上午9:08:53
     * @param str
     * @param strLength
     * @return
     */
    public static String addZeroForNum(String str, int strLength) &#123;  
        int strLen = str.length();  
        if (strLen &lt; strLength) &#123;  
            while (strLen &lt; strLength) &#123;  
                StringBuffer sb = new StringBuffer();  
                sb.append(&quot;0&quot;).append(str);// 左补0    
                str = sb.toString();  
                strLen = str.length();  
            &#125;  
        &#125;  
        return str;  
    &#125;  

    public static void main(String[] args) &#123;
        System.out.println(getLast12Months(&quot;2018-07&quot;));
    &#125;
    
&#125;
</code></pre>
<h2 id="五、oracle-SQL小技巧"><a href="#五、oracle-SQL小技巧" class="headerlink" title="五、oracle SQL小技巧"></a>五、oracle SQL小技巧</h2><h3 id="1、megre-into"><a href="#1、megre-into" class="headerlink" title="1、megre into"></a>1、megre into</h3><pre><code class="prettyprint">MERGE INTO table1 T1
        USING (SELECT  &#39;&#39; cloumn 
                 FROM DUAL) T2
        ON (T1.cloumn      = T2.cloumn)
        WHEN MATCHED THEN
          UPDATE
             SET T1.cloumn1      = T2.cloumn1
        WHEN NOT MATCHED THEN
        insert
          (cloumn1)
        values
          (T2.cloumn1)
</code></pre>
<h3 id="2、连续前几周连续的周日期数据-2019W14-2019W25"><a href="#2、连续前几周连续的周日期数据-2019W14-2019W25" class="headerlink" title="2、连续前几周连续的周日期数据(2019W14-2019W25)"></a>2、连续前几周连续的周日期数据(2019W14-2019W25)</h3><pre><code class="prettyprint">select to_char(t.statCycle, &#39;yyyyMMdd&#39;) statCycleDay,
       to_char(t.statCycle, &#39;yyyy&#39;) || &#39;W&#39; || to_char(t.statCycle, &#39;WW&#39;) statCycle
  from (select Rownum rn,
               (trunc(to_date(&#39;20190622&#39;, &#39;yyyyMMdd&#39;) + Rownum - 7 * 12,
                      &#39;dd&#39;)) statCycle
          from dual
        connect by rownum &lt;= 7 * 12) t
 where t.rn / 7 = cast(t.rn / 7 as int)
 order by t.rn
</code></pre>
<h3 id="3、获取前几天的天日期数据"><a href="#3、获取前几天的天日期数据" class="headerlink" title="3、获取前几天的天日期数据"></a>3、获取前几天的天日期数据</h3><pre><code class="prettyprint">select Rownum rn,
       to_char((trunc(to_date(&#39;20190622&#39;, &#39;yyyyMMdd&#39;) + Rownum - 12, &#39;dd&#39;)),
               &#39;yyyyMMdd&#39;) statCycle
  from dual
connect by rownum &lt;= 12
</code></pre>
<h3 id="4、获取前几个月的月日期数据"><a href="#4、获取前几个月的月日期数据" class="headerlink" title="4、获取前几个月的月日期数据"></a>4、获取前几个月的月日期数据</h3><pre><code class="prettyprint">select k.stat_cycle statCycle
  from (select t.stat_cycle, rownum rn
          from (select to_char(to_date(&#39;201906&#39;, &#39;yyyyMM&#39;), &#39;yyyy&#39;) - 1 ||
                       lpad(level, 2, 0) stat_cycle
                  from dual
                 start with level = 0
                connect by level &lt;= 12
                union all
                select to_char(to_date(&#39;201906&#39;, &#39;yyyyMM&#39;), &#39;yyyy&#39;) ||
                       lpad(level, 2, 0) stat_cycle
                  from dual
                connect by level &lt;=
                           to_char(to_date(&#39;201906&#39;, &#39;yyyyMM&#39;), &#39;MM&#39;)) t) k
 where k.rn &gt; to_char(to_date(&#39;201906&#39;, &#39;yyyyMM&#39;), &#39;MM&#39;)
</code></pre>
<h3 id="5、获取最近24小时数据"><a href="#5、获取最近24小时数据" class="headerlink" title="5、获取最近24小时数据"></a>5、获取最近24小时数据</h3><pre><code class="prettyprint">select Rownum, trunc(sysdate, &#39;hh&#39;) + rownum / 24 past24
  from dual
connect by rownum &lt;= 24
</code></pre>
<h3 id="6、字符串’aaa-bbb-ccc’转表数据’aaa’-’bbb’-’ccc’"><a href="#6、字符串’aaa-bbb-ccc’转表数据’aaa’-’bbb’-’ccc’" class="headerlink" title="6、字符串’aaa,bbb,ccc’转表数据’aaa’,’bbb’,’ccc’"></a>6、字符串’aaa,bbb,ccc’转表数据’aaa’,’bbb’,’ccc’</h3><pre><code class="prettyprint">select regexp_substr(&#39;aaa,bbb,ccc&#39;, &#39;[^,]+&#39;, 1, level)
  from dual
connect by level &lt;=
           length(&#39;aaa,bbb,ccc&#39;) - length(replace(&#39;aaa,bbb,ccc&#39;, &#39;,&#39;)) + 1
</code></pre>
<h3 id="7、Oracle中rank-over-dense-rank-row-number-的区别"><a href="#7、Oracle中rank-over-dense-rank-row-number-的区别" class="headerlink" title="7、Oracle中rank() over, dense_rank(), row_number() 的区别"></a>7、Oracle中rank() over, dense_rank(), row_number() 的区别</h3><pre><code class="prettyprint">--1. rank over ()可以实现对学生排名，特点是成绩相同的两名是并列，如下1 2 2 4 5
select name,
      course,
      rank() over(partition by course order by score desc) as rank
  from student;
--2. dense_rank()和rank over()很像，但学生成绩并列后并不会空出并列所占的名次，如下1 2 2 3 4
 
select name,
      course,
      dense_rank() over(partition by course order by score desc) as rank
  from student;
--3. row_number这个函数不需要考虑是否并列，那怕根据条件查询出来的数值相同也会进行连续排名
select name,
      course,
      row_number() over(partition by course order by score desc) as rank
  from student;
</code></pre>
<h3 id="8、group-by-与-partition-by-区别"><a href="#8、group-by-与-partition-by-区别" class="headerlink" title="8、group by 与 partition by 区别"></a>8、group by 与 partition by 区别</h3><pre><code class="prettyprint">1. partition by用于给结果集进行分区。
2. partition by和group by有何区别？
partition by只是将原始数据进行名次排列(记录数不变)
group by是对原始数据进行聚合统计(记录数可能变少, 每组返回一条)
3. 使用rank over()的时候，空值是最大的，如果排序字段为null, 可能造成null字段排在最前面，影响排序结果。
可以这样： rank over(partition by course order by score desc nulls last)
</code></pre>
<h3 id="9、DDL"><a href="#9、DDL" class="headerlink" title="9、DDL"></a>9、DDL</h3><pre><code class="prettyprint">--修改字段类型
ALTER TABLE ADDRESS MODIFY COLUMN CITY CHAR(30);
--修改字段长度
ALTER TABLE ADDRESS MODIFY COLUMN CITY VARCHAR(32);
--新增字段
ALTER TABLE ADDRESS ADD (CITY VARCHAR2(256));
-- 给字段添加注释
COMMENT ON COLUMN ADDRESS.CITY
  IS &#39;发帖人联系方式&#39;;
</code></pre>
<h3 id="10、plsq注册码"><a href="#10、plsq注册码" class="headerlink" title="10、plsq注册码"></a>10、plsq注册码</h3><p>​	Product Code：4t46t6vydkvsxekkvf3fjnpzy5wbuhphqz</p>
<p>​	serial Number：601769</p>
<p>​	password：xs374ca</p>
<h3 id="11、行转列"><a href="#11、行转列" class="headerlink" title="11、行转列"></a>11、行转列</h3><p>​	<em>LISTAGG</em>(BUY,’,’) WITHIN GROUP(ORDERBYBUYDESC)</p>
<h3 id="12、根据某一个字段排序获取序号"><a href="#12、根据某一个字段排序获取序号" class="headerlink" title="12、根据某一个字段排序获取序号"></a>12、根据某一个字段排序获取序号</h3><p>​	ROW_NUMBER() OVER(PARTITION BY A.org_no ORDER BY a.det_id DESC) rowflag</p>
<h3 id="13、根据某一个字段获取数量"><a href="#13、根据某一个字段获取数量" class="headerlink" title="13、根据某一个字段获取数量"></a>13、根据某一个字段获取数量</h3><p>​	count(*) over(partition by A.org_no) coutflag</p>
<h3 id="14、数据库赋权"><a href="#14、数据库赋权" class="headerlink" title="14、数据库赋权"></a>14、数据库赋权</h3><p>Grant select on iima_comm.table to iima_idx</p>
<h2 id="六、css"><a href="#六、css" class="headerlink" title="六、css"></a>六、css</h2><h3 id="1、google浏览器自动填充颜色"><a href="#1、google浏览器自动填充颜色" class="headerlink" title="1、google浏览器自动填充颜色"></a>1、google浏览器自动填充颜色</h3><pre><code class="prettyprint">input:-webkit-autofill &#123;
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
    -webkit-text-fill-color: rgba(255,255,255,1)!important;

&#125;
</code></pre>
<p>​		<a target="_blank" rel="noopener" href="https://www.cnblogs.com/garfieldzhong/p/4759690.html">input:-webkit-autofill 导致chrome的输入框背景颜色变成黄色</a></p>
<h3 id="2、滚动条改造"><a href="#2、滚动条改造" class="headerlink" title="2、滚动条改造"></a>2、滚动条改造</h3><pre><code class="prettyprint">/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
#table tbody::-webkit-scrollbar&#123;
    width: 16px;
    height: 16px;
    background-color: rgba(24, 13, 120, 1);
&#125;
/*定义滚动条轨道 内阴影+圆角*/
#table tbody::-webkit-scrollbar-track&#123;
    -webkit-box-shadow: inset 0 0 6px #8ab1ff;
    background-color: rgba(24, 13, 120, 1);
&#125;
/*定义滑块 内阴影+圆角*/
#table tbody::-webkit-scrollbar-thumb&#123;
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px #8ab1ff;
    background-color: rgba(95, 137, 220, 1);
&#125;
</code></pre>
<h3 id="3、select下拉框改造"><a href="#3、select下拉框改造" class="headerlink" title="3、select下拉框改造"></a>3、select下拉框改造</h3><pre><code class="prettyprint">#page select::-ms-expand&#123;display:none;&#125;
#page select&#123;
  appearance:none;
 -moz-appearance:none;
 -webkit-appearance:none;
&#125;
#page select &#123;
    appearance:none;
    -moz-appearance:none;
     -webkit-appearance:none;
    -webkit-appearance: menulist;
    box-sizing: border-box;
    align-items: center;
    white-space: pre;
    -webkit-rtl-ordering: logical;
    color: #8ab1ff;
    background-color: rgba(255, 255, 255, -0.6);
    cursor: default;
    border-width: 1px;
    border-style: solid;
    border-color: initial;
    border-image: initial;
    border-radius: 3px;
    height: 22px;
    width: 60px;
    font-size: 16px;
&#125;
#page option &#123;
    background-color: rgb(27,17,117);
&#125;
</code></pre>
<h2 id="七、mysql"><a href="#七、mysql" class="headerlink" title="七、mysql"></a>七、mysql</h2><h3 id="1、this-is-incompatible-with-sql-mode-x3D-only-full-group-by"><a href="#1、this-is-incompatible-with-sql-mode-x3D-only-full-group-by" class="headerlink" title="1、this is incompatible with sql_mode&#x3D;only_full_group_by"></a>1、this is incompatible with sql_mode&#x3D;only_full_group_by</h3><pre><code class="prettyprint">--  mysql 7、8问题
SELECT @@global.sql_mode  
--结果
&#39;ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION&#39;
--修改方式
SET @@global.sql_mode = &#39;STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION&#39;
</code></pre>
<h3 id="2、日期获取"><a href="#2、日期获取" class="headerlink" title="2、日期获取"></a>2、日期获取</h3><pre><code class="prettyprint">SELECT @num:=@num+1 num,DATE_FORMAT(ADDDATE(&#39;2018-06-10&#39;, INTERVAL @num DAY),&#39;%Y-%m-%d&#39;) AS DATE
FROM pt_code,(SELECT @num:=0) t WHERE ADDDATE(&#39;2018-06-10&#39;, INTERVAL @num DAY) &lt;= DATE_FORMAT(CURDATE(),&#39;%Y-%m-%d&#39;)
LIMIT 0,30
</code></pre>
<h3 id="3、转化成数字排序"><a href="#3、转化成数字排序" class="headerlink" title="3、转化成数字排序"></a>3、转化成数字排序</h3><pre><code class="prettyprint">ORDER BY CAST(DATA1 AS SIGNED)
</code></pre>
<h3 id="4、CSV文件导入数据"><a href="#4、CSV文件导入数据" class="headerlink" title="4、CSV文件导入数据"></a>4、CSV文件导入数据</h3><pre><code class="prettyprint">LOAD DATA LOCAL INFILE 
    &#39;C:\\Users\\Administrator\\Desktop\\AAA.csv&#39;
    INTO TABLE `blog`.`k_lrp`
FIELDS ESCAPED BY &#39;\\&#39;  
TERMINATED BY &#39;,&#39;   
ENCLOSED BY &#39;&quot;&#39;  
LINES TERMINATED BY   &#39;\r\n&#39;  
(`LRP_ID`, `ORG_NO`, `YM`, `X_VALUE`, `DATA_OPER_TIME`, `DATA_OPER_TYPE`,`Y_VAULE`)
</code></pre>
<h3 id="5、前2个月"><a href="#5、前2个月" class="headerlink" title="5、前2个月"></a>5、前2个月</h3><pre><code class="prettyprint">SELECT 
  DATE_FORMAT(
    DATE_ADD(
      STR_TO_DATE(CONCAT(&#39;20201210&#39;, &#39;01&#39;), &#39;%Y%m%d&#39;),
      INTERVAL (1 - CAST(k.rn AS SIGNED INTEGER)) MONTH
    ),
    &#39;%Y%m&#39;
  ) stat_cycle 
FROM
  (SELECT 
    @rn := @rn + 1 rn 
  FROM
    pt_code g,
    (SELECT 
      @rn := 0) f 
  LIMIT 0, 31) k 
WHERE k.rn &lt;= 12 
</code></pre>
<h3 id="6、前30天数据"><a href="#6、前30天数据" class="headerlink" title="6、前30天数据"></a>6、前30天数据</h3><pre><code class="prettyprint">--不包含当天
SELECT @num:=@num+1 num,DATE_FORMAT(ADDDATE(&#39;20201210&#39;, INTERVAL -@num DAY),&#39;%Y%m%d&#39;) AS stat_cycle
FROM pt_code,(SELECT @num:=0) t
LIMIT 0,30
--包含当天
SELECT @num:=@num+1 num,DATE_FORMAT(ADDDATE(&#39;20201210&#39;, INTERVAL 1-@num DAY),&#39;%Y%m%d&#39;) AS stat_cycle
FROM pt_code,(SELECT @num:=0) t
LIMIT 0,30
</code></pre>
<h2 id="八、nginx"><a href="#八、nginx" class="headerlink" title="八、nginx"></a>八、nginx</h2><h3 id="1、win启动"><a href="#1、win启动" class="headerlink" title="1、win启动"></a>1、win启动</h3><p>cmd进入nginx根目录执行   <code>nginx -t -c conf\nginx.conf</code></p>
<p>重启：nginx -s reload</p>
<p>启动：start nginx</p>
<p>停止：nginx -s stop</p>
<h3 id="2、简单配置"><a href="#2、简单配置" class="headerlink" title="2、简单配置"></a>2、简单配置</h3><pre><code class="prettyprint.conf"> server &#123;
        listen       8088;
        server_name  172.19.3.229;
        location /http-bind&#123;
            #重定向openfire请求
            proxy_pass http://172.19.3.229:17070/http-bind;
            proxy_buffering off;
            proxy_redirect off;
            proxy_read_timeout 120;
            proxy_connect_timeout 600;
        &#125;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html &#123;
            root   html;
        &#125;
    &#125;
</code></pre>
<h2 id="九、javascript"><a href="#九、javascript" class="headerlink" title="九、javascript"></a>九、javascript</h2><h3 id="1、变化title"><a href="#1、变化title" class="headerlink" title="1、变化title"></a>1、变化title</h3><pre><code class="prettyprint">document.addEventListener(&#39;visibilitychange&#39;,function()&#123;
    if(document.visibilityState==&#39;hidden&#39;)&#123;
        normal_title=document.title;
        document.title=&#39;来啊.快活啊&#39;;
    &#125;else&#123;
        document.title=normal_title;
    &#125;
&#125;);
</code></pre>
<h3 id="3、js实现模态框拖拽"><a href="#3、js实现模态框拖拽" class="headerlink" title="3、js实现模态框拖拽"></a>3、js实现模态框拖拽</h3><pre><code class="prettyprint">//拖拽功能(主要是触发三个事件：onmousedown\onmousemove\onmouseup) 
var drag = document.getElementById(&#39;drag&#39;);
//点击某物体时，用drag对象即可，move和up是全局区域，也就是整个文档通用，应该使用document对象而不是drag对象(否则，采用drag对象时物体只能往右方或下方移动) 
drag.onmousedown = function(e) &#123;
    var e = e || window.event; //兼容ie浏览器 
    var diffX = e.clientX - drag.offsetLeft; //鼠标点击物体那一刻相对于物体左侧边框的距离=点击时的位置相对于浏览器最左边的距离-物体左边框相对于浏览器最左边的距离 
    var diffY = e.clientY - drag.offsetTop;
    /*低版本ie bug:物体被拖出浏览器可是窗口外部时，还会出现滚动条， 
              解决方法是采用ie浏览器独有的2个方法setCapture()\releaseCapture(),这两个方法， 
              可以让鼠标滑动到浏览器外部也可以捕获到事件，而我们的bug就是当鼠标移出浏览器的时候， 
              限制超过的功能就失效了。用这个方法，即可解决这个问题。注：这两个方法用于onmousedown和onmouseup中*/
    if(typeof drag.setCapture != &#39;undefined&#39;) &#123;
        drag.setCapture();
    &#125;
    document.onmousemove = function(e) &#123;
        var e = e || window.event; //兼容ie浏览器 
        var left = e.clientX - diffX;
        var top = e.clientY - diffY;
        //控制拖拽物体的范围只能在浏览器视窗内，不允许出现滚动条 
        if(left &lt; 0) &#123;
            left = 0;
        &#125; else if(left &gt; window.innerWidth - drag.offsetWidth) &#123;
            left = window.innerWidth - drag.offsetWidth;
        &#125;
        if(top &lt; 0) &#123;
            top = 0;
        &#125; else if(top &gt; window.innerHeight - drag.offsetHeight) &#123;
            top = window.innerHeight - drag.offsetHeight;
        &#125;
        //移动时重新得到物体的距离，解决拖动时出现晃动的现象 
        drag.style.left = left + &#39;px&#39;;
        drag.style.top = top + &#39;px&#39;;
    &#125;;
    document.onmouseup = function(e) &#123; //当鼠标弹起来的时候不再移动 
        this.onmousemove = null;
        this.onmouseup = null; //预防鼠标弹起来后还会循环（即预防鼠标放上去的时候还会移动） 
        //修复低版本ie bug 
        if(typeof drag.releaseCapture != &#39;undefined&#39;) &#123;
            drag.releaseCapture();
        &#125;
    &#125;;
&#125;;
</code></pre>
<h3 id="3、字符转义"><a href="#3、字符转义" class="headerlink" title="3、字符转义"></a>3、字符转义</h3><pre><code class="prettyprint">var HtmlUtil = &#123;
    /*1.用浏览器内部转换器实现html转码*/
    htmlEncode:function (html)&#123;
        //1.首先动态创建一个容器标签元素，如DIV
        var temp = document.createElement (&quot;div&quot;);
        //2.然后将要转换的字符串设置为这个元素的innerText(ie支持)或者textContent(火狐，google支持)
        (temp.textContent != undefined ) ? (temp.textContent = html) : (temp.innerText = html);
        //3.最后返回这个元素的innerHTML，即得到经过HTML编码转换的字符串了
        var output = temp.innerHTML;
        temp = null;
        return output;
    &#125;,
    /*2.用浏览器内部转换器实现html解码*/
    htmlDecode:function (text)&#123;
        //1.首先动态创建一个容器标签元素，如DIV
        var temp = document.createElement(&quot;div&quot;);
        //2.然后将要转换的字符串设置为这个元素的innerHTML(ie，火狐，google都支持)
        temp.innerHTML = text;
        //3.最后返回这个元素的innerText(ie支持)或者textContent(火狐，google支持)，即得到经过HTML解码的字符串了。
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
    &#125;,
    /*3.用正则表达式实现html转码*/
    htmlEncodeByRegExp:function (str)&#123;  
        var s = &quot;&quot;;
        if(str.length == 0) return &quot;&quot;;
        s = str.replace(/&amp;/g,&quot;&amp;amp;&quot;);
        s = s.replace(/&lt;/g,&quot;&amp;lt;&quot;);
        s = s.replace(/&gt;/g,&quot;&amp;gt;&quot;);
        s = s.replace(/ /g,&quot;&amp;nbsp;&quot;);
        s = s.replace(/\&#39;/g,&quot;&amp;#39;&quot;);
        s = s.replace(/\&quot;/g,&quot;&amp;quot;&quot;);
        return s;  
    &#125;,
    /*4.用正则表达式实现html解码*/
    htmlDecodeByRegExp:function (str)&#123;  
        var s = &quot;&quot;;
        if(str.length == 0) return &quot;&quot;;
        s = str.replace(/&amp;amp;/g,&quot;&amp;&quot;);
        s = s.replace(/&amp;lt;/g,&quot;&lt;&quot;);
        s = s.replace(/&amp;gt;/g,&quot;&gt;&quot;);
        s = s.replace(/&amp;nbsp;/g,&quot; &quot;);
        s = s.replace(/&amp;#39;/g,&quot;\&#39;&quot;);
        s = s.replace(/&amp;quot;/g,&quot;\&quot;&quot;);
        return s;  
    &#125;
&#125;;
</code></pre>
<h3 id="4、js关闭页面"><a href="#4、js关闭页面" class="headerlink" title="4、js关闭页面"></a>4、js关闭页面</h3><pre><code class="prettyprint">function CloseWebPage() &#123;
    if (navigator.userAgent.indexOf(&quot;MSIE&quot;) &gt; 0) &#123;
        if (navigator.userAgent.indexOf(&quot;MSIE 6.0&quot;) &gt; 0) &#123;
            window.opener = null;
            window.close();
        &#125; else &#123;
            window.open(&#39; &#39;, &#39;_top&#39;);
            window.top.close();
        &#125;
    &#125; else if (navigator.userAgent.indexOf(&quot;Firefox&quot;) &gt; 0) &#123;
        window.opener = null;
        window.open(&#39; &#39;, &#39;_top&#39;);
        window.close();
    &#125; else if (navigator.userAgent.indexOf(&quot;Chrome&quot;) &gt; 0) &#123;
        window.opener = null;
        window.open(&#39; &#39;, &#39;_self&#39;);
        window.close();
    &#125; else &#123;
        window.opener = null;
        window.open(&#39; &#39;, &#39;_self&#39;);
        window.close();
    &#125;
&#125;
</code></pre>
<h3 id="5、div滚动播放"><a href="#5、div滚动播放" class="headerlink" title="5、div滚动播放"></a>5、div滚动播放</h3><pre><code class="prettyprint">&lt;div class=&quot;scroll-div&quot;&gt;
    &lt;ul&gt;
        &lt;li&gt;
            aaaa
        &lt;/li&gt;
        &lt;li&gt;
            bbb
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
</code></pre>
<pre><code class="prettyprint">/*滚动js*/
$(&#39;.scroll-div li:even&#39;).addClass(&#39;lieven&#39;);

$(&quot;div.scroll-div&quot;).myScroll(&#123;
    speed:13, //数值越大，速度越慢
    rowHeight:270 //li的高度
&#125;);
$.fn.myScroll = function(options)&#123;
        //默认配置
        var defaults = &#123;
            speed:40,  //滚动速度,值越大速度越慢
            rowHeight:24 //每行的高度
        &#125;;
        var opts = $.extend(&#123;&#125;, defaults, options),intId = [];
        this.each(function(i)&#123;
            var sh = opts[&quot;rowHeight&quot;];
            var speed = opts[&quot;speed&quot;];
            var _this = $(this);
            intId[i] = setInterval(function()&#123;
                marquee(_this, sh);
            &#125;, speed);

            _this.hover(function()&#123;
                clearInterval(intId[i]);
            &#125;,function()&#123;
                intId[i] = setInterval(function()&#123;
                    marquee(_this, sh);
                &#125;, speed);
            &#125;);
        
        &#125;);
        //滚动效果
        function marquee(obj, step)&#123;
            obj.find(&quot;ul&quot;).animate(&#123;
                marginTop: &#39;-=1&#39;
            &#125;,0,function()&#123;
                var s = Math.abs(parseInt($(this).css(&quot;margin-top&quot;)));
                if(s &gt;= step)&#123;
                    $(this).find(&quot;li&quot;).slice(0, 1).appendTo($(this));
                    $(this).css(&quot;margin-top&quot;, 0);
                &#125;
            &#125;);
        &#125;
    &#125;
&#125;)(jQuery);
</code></pre>
<pre><code class="prettyprint">.scroll-div&#123;
    overflow:hidden;
    font-size:13px; 
    margin-top: 12px;
    height: 268px;
&#125;
.scroll-div ul,
.scroll-div ul li&#123;
    height: 273px;
    width: 100%;
&#125;
</code></pre>
<h2 id="十、redis"><a href="#十、redis" class="headerlink" title="十、redis"></a>十、redis</h2><h3 id="1、查看连接数"><a href="#1、查看连接数" class="headerlink" title="1、查看连接数"></a>1、查看连接数</h3><p>​	netstat -an|grep 6379|wc -l</p>
<h2 id="十一、正则表达式"><a href="#十一、正则表达式" class="headerlink" title="十一、正则表达式"></a>十一、正则表达式</h2><h3 id="1、阶段替换"><a href="#1、阶段替换" class="headerlink" title="1、阶段替换"></a>1、阶段替换</h3><pre><code class="prettyprint">String sql = &quot;select * from a where a.no = #&#123;no,jdbcType=VARCHAR&#125; and a.name = #&#123;name,jdbcType=VARCHAR&#125;&quot;;
sql.replaceAll(&quot;\\#\\&#123;.+?\\&#125;&quot;,&quot;?&quot;); 
//sql = select * from a where a.no = ? and a.name = ? 
</code></pre>
<h2 id="十二、cron范例"><a href="#十二、cron范例" class="headerlink" title="十二、cron范例"></a>十二、cron范例</h2><pre><code>每隔5秒执行一次：*/5 * * * * ?

每隔1分钟执行一次：0 */1 * * * ?

每天23点执行一次：0 0 23 * * ?

每天凌晨1点执行一次：0 0 1 * * ?

每月1号凌晨1点执行一次：0 0 1 1 * ?

每月最后一天23点执行一次：0 0 23 L * ?

每周星期天凌晨1点实行一次：0 0 1 ? * L

在26分、29分、33分执行一次：0 26,29,33 * * * ?

每天的0点、13点、18点、21点都执行一次：0 0 0,13,18,21 * * ?
</code></pre>

      </section>

      
      
        <nav class="article-nav">
          
            <div class="article-nav-item layout-padding">
  <article class="card-container article-nav-card content-padding--primary soft-size--large soft-style--box">
    
      <div class="card-cover" background-image-lazy data-img="/images/upload/2021/10/2.jpg"></div>
    
    <div class="card-text">
      
        <a href="/2021/08/31/ruo-yi-xue-xi-yan-zheng-ma/" itemprop="url">
          <h2 class="card-text--title text-ellipsis">若依学习-验证码</h2>
        </a>
      
      <div class="card-text--row">Newer</div>
    </div>
  </article>
</div>
          
          
        </nav>
      

      <section class="page-message-container layout-padding">
        


  
  
    <div class="valine-container comments-container content-padding--primary soft-size--large soft-style--box">
      <div id="valine_thread" class="valine-thread"></div>
    </div>
    <script type="text/javascript" src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script type="text/javascript" src='//unpkg.com/valine/dist/Valine.min.js'></script>
    <script type="text/javascript">
      new Valine({
        el: "#valine_thread",
        appId: "yEts8yIOQopn7imcDAmwhlNi-gzGzoHsz",
        appKey: "nyOyHJdsDGQh3UI0TdNdLLnN",
        avatar: "mm",
        placeholder: "随便说点什么叭～",
        notify: true,
        visitor: true,
        pageSize: 10,
      });
    </script>
  

  
  


      </section>
    </div>
    <div class="widget-info">
      <section class="widget-calendar widget-item layout-margin content-padding--primary soft-size--large soft-style--box">
  <div class="widget-body">
	<div id="calendar"></div>
  </div>
</section>

      <section class="widget-categorys widget-item layout-margin content-padding--primary soft-size--large soft-style--box">
  <div class="widget-title">
    <svg class="icon icon-categories" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M900.3614811 257.09082106h-339.81629553l-67.96326003-101.9448889c-19.41807444-29.12711113-48.54518557-43.69066667-82.52681443-43.69066667H123.6385189c-53.39970333 0-97.09036999 43.69066667-97.09037113 97.09036999v582.54222222c0 53.39970333 43.69066667 97.09036999 97.09037113 97.09037002h776.7229622c53.39970333 0 97.09036999-43.69066667 97.09037113-97.09037002V354.18119104c0-53.39970333-43.69066667-97.09036999-97.09037113-97.09036998z m-97.09036999 242.72592554H220.72888889c-24.27259221 0-48.54518557-24.27259221-48.54518556-48.54518556s24.27259221-48.54518557 48.54518556-48.54518444h582.54222222c24.27259221 0 48.54518557 24.27259221 48.54518556 48.54518444s-24.27259221 48.54518557-48.54518556 48.54518556z" fill="currentColor"></path>
</svg>
    <span>CATEGORYS</span>
  </div>
  <div class="widget-body">
    <ul class="categorys-list">
      
        <li class="categorys-list-item">
          <a href="/categories/%E6%8A%80%E6%9C%AF/">
            技术 (11)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E7%AE%97%E6%B3%95/">
            算法 (15)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E5%B7%A5%E5%85%B7/">
            工具 (3)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E9%97%AE%E9%A2%98/">
            问题 (8)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E8%BD%AF%E4%BB%B6/">
            软件 (31)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E4%B8%AD%E9%97%B4%E4%BB%B6/">
            中间件 (26)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E5%90%8E%E7%AB%AF/">
            后端 (1)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/java/">
            java (4)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E6%95%B0%E6%8D%AE/">
            数据 (5)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/linux/">
            linux (3)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/web/">
            web (1)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E7%89%9B%E8%B7%AF%E6%9D%91/">
            牛路村 (1)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E9%97%B2%E8%B0%88/">
            闲谈 (5)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E5%89%8D%E7%AB%AF/">
            前端 (1)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E5%BE%AE%E4%BF%A1/">
            微信 (1)
          </a>
        </li>
      
        <li class="categorys-list-item">
          <a href="/categories/%E8%8B%A5%E4%BE%9D/">
            若依 (1)
          </a>
        </li>
      
    </ul>
  </div>
</section>

      <section class="widget-tags widget-item  layout-margin content-padding--primary soft-size--large soft-style--box">
  <div class="widget-title">
    <svg class="icon icon-tags" viewBox="0 0 1098 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M283.42180005 272q0-28.38857157-20.09142843-48.48000001t-48.47999998-20.09142842-48.48000002 20.09142842-20.09142846 48.48000001 20.09142846 48.48 48.48000002 20.09142843 48.47999998-20.09142843 20.09142843-48.48zM855.0332285 580.57142843q0 28.38857157-19.81714313 48.2057147l-263.03999997 263.58857157q-20.9142853 19.81714313-48.75428534 19.81714312-28.38857157 0-48.20571468-19.81714312l-383.04-383.58857157q-20.36571468-19.81714313-34.55999999-54.10285688t-14.19428534-62.6742853l0-222.85714313q0-27.84000002 20.36571469-48.20571469t48.2057147-20.36571466l222.85714313 0q28.38857157 0 62.6742853 14.19428529t54.65142842 34.55999999l383.04000001 382.49142843q19.81714313 20.9142853 19.81714314 48.75428532zM1060.74751475 580.57142843q0 28.38857157-19.81714313 48.2057147l-263.04 263.58857157q-20.9142853 19.81714313-48.75428531 19.81714312-19.26857155 0-31.61142843-7.47428531t-28.38857159-24.13714314l251.79428534-251.7942853q19.81714313-19.81714313 19.81714308-48.20571469 0-27.84000002-19.81714308-48.75428531l-383.04000001-382.49142845q-20.36571468-20.36571468-54.65142842-34.55999999t-62.67428532-14.19428534l120 0q28.38857157 0 62.67428532 14.19428534t54.65142842 34.55999999l383.03999998 382.49142845q19.81714313 20.9142853 19.81714314 48.75428531z" fill="currentColor"></path>
</svg>
    <span>TAGS</span>
  </div>
  <div class="widget-body">
    <div class="tags-cloud">
      <a href="/tags/crontab/" style="font-size: 10px;" class="tags-cloud-0">crontab</a> <a href="/tags/docker/" style="font-size: 20px;" class="tags-cloud-10">docker</a> <a href="/tags/elasticsearch/" style="font-size: 10px;" class="tags-cloud-0">elasticsearch</a> <a href="/tags/fastdfs/" style="font-size: 10px;" class="tags-cloud-0">fastdfs</a> <a href="/tags/git/" style="font-size: 10px;" class="tags-cloud-0">git</a> <a href="/tags/go/" style="font-size: 12.5px;" class="tags-cloud-3">go</a> <a href="/tags/hexo/" style="font-size: 10px;" class="tags-cloud-0">hexo</a> <a href="/tags/idea/" style="font-size: 10px;" class="tags-cloud-0">idea</a> <a href="/tags/jvm/" style="font-size: 11.25px;" class="tags-cloud-1">jvm</a> <a href="/tags/kafka/" style="font-size: 11.25px;" class="tags-cloud-1">kafka</a> <a href="/tags/linux/" style="font-size: 15px;" class="tags-cloud-5">linux</a> <a href="/tags/maven/" style="font-size: 10px;" class="tags-cloud-0">maven</a> <a href="/tags/minio/" style="font-size: 11.25px;" class="tags-cloud-1">minio</a> <a href="/tags/mysql/" style="font-size: 13.75px;" class="tags-cloud-4">mysql</a> <a href="/tags/nginx/" style="font-size: 12.5px;" class="tags-cloud-3">nginx</a> <a href="/tags/node/" style="font-size: 10px;" class="tags-cloud-0">node</a> <a href="/tags/oracle/" style="font-size: 10px;" class="tags-cloud-0">oracle</a> <a href="/tags/pulsar/" style="font-size: 10px;" class="tags-cloud-0">pulsar</a> <a href="/tags/rabbitmq/" style="font-size: 17.5px;" class="tags-cloud-8">rabbitmq</a> <a href="/tags/redis/" style="font-size: 16.25px;" class="tags-cloud-6">redis</a> <a href="/tags/redis-%E4%BA%8B%E5%8A%A1/" style="font-size: 10px;" class="tags-cloud-0">redis,事务</a> <a href="/tags/rocketmq/" style="font-size: 17.5px;" class="tags-cloud-8">rocketmq</a> <a href="/tags/shell/" style="font-size: 10px;" class="tags-cloud-0">shell</a> <a href="/tags/spring/" style="font-size: 10px;" class="tags-cloud-0">spring</a> <a href="/tags/tomcat/" style="font-size: 10px;" class="tags-cloud-0">tomcat</a> <a href="/tags/vim/" style="font-size: 10px;" class="tags-cloud-0">vim</a> <a href="/tags/yml/" style="font-size: 10px;" class="tags-cloud-0">yml</a> <a href="/tags/zookeeper/" style="font-size: 10px;" class="tags-cloud-0">zookeeper</a> <a href="/tags/%E4%B8%87%E5%B9%B4%E5%8F%B0/" style="font-size: 10px;" class="tags-cloud-0">万年台</a> <a href="/tags/%E4%B8%AD%E9%97%B4%E4%BB%B6/" style="font-size: 18.75px;" class="tags-cloud-9">中间件</a> <a href="/tags/%E4%BA%8B%E5%8A%A1/" style="font-size: 10px;" class="tags-cloud-0">事务</a> <a href="/tags/%E5%8A%A0%E5%AF%86/" style="font-size: 13.75px;" class="tags-cloud-4">加密</a> <a href="/tags/%E5%93%A8%E5%85%B5/" style="font-size: 10px;" class="tags-cloud-0">哨兵</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 11.25px;" class="tags-cloud-1">工具</a> <a href="/tags/%E5%B8%B8%E7%94%A8%E7%AE%97%E6%B3%95/" style="font-size: 16.25px;" class="tags-cloud-6">常用算法</a> <a href="/tags/%E5%B9%B6%E5%8F%91/" style="font-size: 10px;" class="tags-cloud-0">并发</a> <a href="/tags/%E6%96%87%E4%BB%B6%E5%AD%98%E5%82%A8/" style="font-size: 11.25px;" class="tags-cloud-1">文件存储</a> <a href="/tags/%E7%B4%A2%E5%BC%95/" style="font-size: 10px;" class="tags-cloud-0">索引</a> <a href="/tags/%E9%94%81%E6%9C%BA%E5%88%B6/" style="font-size: 10px;" class="tags-cloud-0">锁机制</a> <a href="/tags/%E9%97%AE%E9%A2%98/" style="font-size: 10px;" class="tags-cloud-0">问题</a>
    </div>
  </div>
</section>
    </div>
  </article>
</div>
<script>
	//解决中文转义无法跳转锚点问题
	var blog = document.querySelector("#blog-content");
	var content = blog.innerHTML;
	var regExp2 = /<h([1-6]) id=\"(\S*?)\">/g;
	var	data = content.replace(regExp2, function(word,i){
		var ws = word.split("\"");
			return ws[0]+"\""+encodeURIComponent(ws[1])+"\""+ws[2];
		},"g");
	blog.innerHTML = data;
</script>

    <!-- footer container -->
<footer id="footer" class="footer">
  <div class="footer-container">
    
    <div class="social-icons">
      
        
          <a href="https://music.163.com/#/user/home?id=444731906" class="soft-size--primary soft-style--box" target="_blank" rel="noopener noreferrer">
            <svg class="icon icon-<%= icon %>" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <path d="M952.17867 503.263237a341.054956 341.054956 0 0 0-56.853199-113.706399 408.604266 408.604266 0 0 0-109.723463-98.352823 304.662484 304.662484 0 0 0-143.257215-42.077792L621.305897 170.238394a40.343287 40.343287 0 0 1 10.792472-36.392472 56.88532 56.88532 0 0 1 36.392472-18.758344 102.785445 102.785445 0 0 1 56.853199 18.758344c6.263488 3.404768 10.792472 9.090088 17.05596 13.073024a57.335006 57.335006 0 0 0 82.999247-70.632873 66.521455 66.521455 0 0 0-22.74128-27.848432 237.691343 237.691343 0 0 0-89.262735-43.202007A170.559598 170.559598 0 0 0 625.288833 6.42409a167.026349 167.026349 0 0 0-60.836135 37.516688 164.328231 164.328231 0 0 0-40.921456 51.713927 156.908407 156.908407 0 0 0-8.54404 113.706399l13.651192 52.870264a284.298118 284.298118 0 0 0-158.064743 109.209535 256.963614 256.963614 0 0 0-43.202007 156.908407 248.419573 248.419573 0 0 0 13.651192 74.487327 205.281807 205.281807 0 0 0 80.718695 104.616312 185.945295 185.945295 0 0 0 136.447679 25.696361 193.879046 193.879046 0 0 0 156.330238-196.705646L708.802008 503.263237c-11.948808-46.060728-24.443664-91.543287-35.814304-137.025847a182.283563 182.283563 0 0 1 47.763112 18.180176 316.611292 316.611292 0 0 1 47.763111 34.690088A239.907654 239.907654 0 0 1 840.752823 529.987453a284.169636 284.169636 0 0 1 0 158.064743 252.241907 252.241907 0 0 1-21.584943 51.167879 308.741782 308.741782 0 0 1-168.279047 144.542033 387.918695 387.918695 0 0 1-130.184191 23.319448 332.607277 332.607277 0 0 1-155.206022-37.516688A367.233124 367.233124 0 0 1 194.87478 672.666499a373.014806 373.014806 0 0 1-20.460727-180.806022A366.173149 366.173149 0 0 1 406.869762 198.536512a57.399247 57.399247 0 0 0 13.073023-100.055207 76.189711 76.189711 0 0 0-63.662735-3.404768A479.815307 479.815307 0 0 0 68.705646 436.163614a488.905395 488.905395 0 0 0 129.027855 450.84266 454.857716 454.857716 0 0 0 248.997741 131.886574 470.885822 470.885822 0 0 0 138.117942 0A454.889837 454.889837 0 0 0 773.042911 952.949561a427.523212 427.523212 0 0 0 170.559598-209.232622 417.276788 417.276788 0 0 0 22.74128-109.209536 378.089837 378.089837 0 0 0-14.165119-131.244166z m-412.747804 118.845671a72.174655 72.174655 0 0 1-56.8532-10.792471 98.352823 98.352823 0 0 1-37.516687-61.382184 170.68808 170.68808 0 0 1 0-65.943287 133.042911 133.042911 0 0 1 33.533751-63.662735 181.35207 181.35207 0 0 1 80.718695-46.606776l39.219072 148.364367a204.189711 204.189711 0 0 1 5.107152 26.146048 79.594479 79.594479 0 0 1-64.208783 73.844918z"></path>
  </svg>
          </a>
        
      
        
          <a href="https://www.zhihu.com" class="soft-size--primary soft-style--box" target="_blank" rel="noopener noreferrer">
            <svg t="1587373160860" class="icon icon-zhihu" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M544.949 561.422s0-71.387-34.779-75.050c-34.779-3.663-142.775 0-142.775 0v-219.654h161.078s-1.83-73.219-32.949-73.219h-261.755l43.93-117.148s-65.897 3.663-89.692 45.761-98.844 252.604-98.844 252.604 25.627 10.983 67.726-20.134c42.101-31.116 56.743-86.033 56.743-86.033l76.879-3.663 1.83 223.316s-133.621-1.83-161.078 0c-27.457 1.83-42.101 75.050-42.101 75.050h203.182s-18.307 124.47-69.557 214.164c-53.085 89.692-151.929 161.078-151.929 161.078s71.387 29.287 140.947-10.983c69.557-42.101 120.811-223.316 120.811-223.316l162.912 203.182s14.643-97.013-1.83-124.47c-18.307-27.457-113.49-137.283-113.49-137.283l-42.101 36.607 29.287-120.811h177.552zM587.050 188.010l-1.83 660.793h65.897l23.795 82.37 115.321-82.37h162.912v-660.793h-366.091zM879.92 775.584h-76.879l-97.013 75.050-21.965-75.050h-20.134v-512.527h215.991v512.527z"></path>
</svg>
          </a>
        
      
        
          <a href="https://gitee.com/RocPengHua" class="soft-size--primary soft-style--box" target="_blank" rel="noopener noreferrer">
            <svg class="icon icon-<%= icon %>" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <path d="M512 1024C229.248 1024 0 794.752 0 512S229.248 0 512 0s512 229.248 512 512-229.248 512-512 512z m259.168-568.896h-290.752a25.28 25.28 0 0 0-25.28 25.28l-0.032 63.232c0 13.952 11.296 25.28 25.28 25.28h177.024a25.28 25.28 0 0 1 25.28 25.28v12.64a75.84 75.84 0 0 1-75.84 75.84h-240.224a25.28 25.28 0 0 1-25.28-25.28v-240.192a75.84 75.84 0 0 1 75.84-75.84h353.92a25.28 25.28 0 0 0 25.28-25.28l0.064-63.2a25.312 25.312 0 0 0-25.28-25.312H417.184a189.632 189.632 0 0 0-189.632 189.6v353.952c0 13.952 11.328 25.28 25.28 25.28h372.928a170.656 170.656 0 0 0 170.656-170.656v-145.376a25.28 25.28 0 0 0-25.28-25.28z" p-id="1954"></path>
  </svg>
          </a>
        
      
        
          <a href="https://github.com/RocPengHua" class="soft-size--primary soft-style--box" target="_blank" rel="noopener noreferrer">
            <svg class="icon icon-github" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M64.6 512c0 195.6 125.4 361.9 300.1 422.9 23.5 5.9 19.9-10.8 19.9-22.2v-77.6c-135.8 15.9-141.3-74-150.5-89-18.5-31.5-61.9-39.5-49-54.5 31-15.9 62.5 4 98.9 58 26.4 39.1 77.9 32.5 104.1 26 5.7-23.5 17.9-44.5 34.7-60.9-140.7-25.2-199.4-111.1-199.4-213.3 0-49.5 16.4-95.1 48.4-131.8-20.4-60.6 1.9-112.4 4.9-120.1 58.2-5.2 118.5 41.6 123.3 45.3 33.1-8.9 70.8-13.7 112.9-13.7 42.4 0 80.3 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.4-43.9 2.9 7.7 24.7 58.3 5.5 118.1 32.5 36.8 49 82.8 49 132.4 0 102.3-59 188.3-200.2 213.2 23.5 23.3 38.1 55.5 38.1 91.1v112.7c0.8 9 0 17.9 15.1 17.9C832.7 877 960.4 709.4 960.4 512.1c0-247.5-200.6-447.9-447.9-447.9C265 64.1 64.6 264.5 64.6 512z"></path>
</svg>
          </a>
        
      
        
          <a href="https://twitter.com/guanquanhong" class="soft-size--primary soft-style--box" target="_blank" rel="noopener noreferrer">
            <svg class="icon icon-twitter" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M962.285714 233.142857q-38.285714 56-92.571429 95.428571 0.571429 8 0.571429 24 0 74.285714-21.714286 148.285714t-66 142-105.428571 120.285714-147.428571 83.428571-184.571429 31.142857q-154.857143 0-283.428571-82.857143 20 2.285714 44.571429 2.285714 128.571429 0 229.142857-78.857143-60-1.142857-107.428571-36.857143t-65.142857-91.142857q18.857143 2.857143 34.857143 2.857143 24.571429 0 48.571429-6.285714-64-13.142857-106-63.714286t-42-117.428571l0-2.285714q38.857143 21.714286 83.428571 23.428571-37.714286-25.142857-60-65.714286t-22.285714-88q0-50.285714 25.142857-93.142857 69.142857 85.142857 168.285714 136.285714t212.285714 56.857143q-4.571429-21.714286-4.571429-42.285714 0-76.571429 54-130.571429t130.571429-54q80 0 134.857143 58.285714 62.285714-12 117.142857-44.571429-21.142857 65.714286-81.142857 101.714286 53.142857-5.714286 106.285714-28.571429z"></path>
</svg>
          </a>
        
      
    </div>
     
    <p>&copy; 2024 <a href="/" target="_blank">RocPengHua</a></p>

    

    <p>Powered by <a href="https://hexo.io" target="_blank" rel="noopener noreferrer">Hexo</a> Theme - <a href="https://github.com/miiiku/flex-block" target="_blank" rel="noopener noreferrer author">flex-block</a></p>

    <p>
      <a href="javascript:;" id="theme-light">🌞 浅色</a>
      <a href="javascript:;" id="theme-dark">🌛 深色</a>
      <a href="javascript:;" id="theme-auto">🤖️ 自动</a>
    </p>
  </div>
</footer>
  </div>

  <div class="back-to-top-fixed soft-size--round soft-style--box">
    <svg class="icon icon-back-to-top" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
      <path d="M725.333333 426.666667c-12.8 0-21.333333-4.266667-29.866667-12.8l-213.333333-213.333333c-17.066667-17.066667-17.066667-42.666667 0-59.733333s42.666667-17.066667 59.733333 0l213.333333 213.333333c17.066667 17.066667 17.066667 42.666667 0 59.733333C746.666667 422.4 738.133333 426.666667 725.333333 426.666667z"></path>
      <path d="M298.666667 426.666667c-12.8 0-21.333333-4.266667-29.866667-12.8-17.066667-17.066667-17.066667-42.666667 0-59.733333l213.333333-213.333333c17.066667-17.066667 42.666667-17.066667 59.733333 0s17.066667 42.666667 0 59.733333l-213.333333 213.333333C320 422.4 311.466667 426.666667 298.666667 426.666667z"></path>
      <path d="M512 896c-25.6 0-42.666667-17.066667-42.666667-42.666667L469.333333 170.666667c0-25.6 17.066667-42.666667 42.666667-42.666667s42.666667 17.066667 42.666667 42.666667l0 682.666667C554.666667 878.933333 537.6 896 512 896z"></path>
    </svg>
  </div>

  
  <!-- aplayer -->


<!-- dplayer -->




  


  


  <!-- Baidu Analytics START -->
  <script>
    var _hmt = _hmt || [];
    (function () {
      if (window.location.hostname === "localhost" || window.location.hostname.startsWith("192.168")) {
        return console.log("本地调试");
      }
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?true";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>
  <!-- Baidu Analytics End -->

  




<script src="/js/script.js"></script>


  
  <link rel="stylesheet" href="/lib/aplayer/APlayer.min.css">
<script type="text/javascript" src="/lib/aplayer/APlayer.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="/js/search.js"></script>

<!-- Calendar -->

    <script src="/js/calendar.js"></script>
    <script src="/js/languages.js"></script>
    <script type="text/javascript">
        $(function() {
            $('#calendar').aCalendar(
                'zh-CN',
                {single:false, root:'calendar/'}
            );
        });
    </script>

<!-- 尾部用户自定义相关内容 -->
<div id="aplayer"></div>
<script type="text/javascript">

	/*获取音乐*/
	$.get("https://api.i-meto.com/meting/api?server=netease&type=playlist&id=3778678&r=0.37201068616290645", function(result){
		if(result && result.code  == 50000){
			console.log(result.msg);
			return;
		}
	    const ap = new APlayer({
	    container: document.getElementById('aplayer'),
	    global:true,
	    id:'3778678',
	    server: 'netease',
	    type: 'paylist',
	    fixed: true,
	    preload: 'none',
	    theme: '#ffa500',
	    autoplay: false,
	    audio: result
	  });
	});










	/*图片放大js*/
	function createImgEventFullScreen() {
        var imgs = $(".post-container").find("img");
        for (var i = 0; i < imgs.length; i++) {
            // $(imgs[i]).click(createCover(imgs[i]));
            imgs[i].onclick = function (e) {
                var src = e.srcElement.currentSrc;
                var _this = $(this);
                console.log(_this);
                createCover(src,_this);
            }
        }
        function createCover(src,_this) {
            console.log(_this);
            console.log(src);
            var cover = $("<div id='outerDiv'  style='position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:5;width:100%;height:100%;display:none;'><div id='innerDiv' style='position:absolute;'><img  id='bigImg' style='border:5px solid #fff;' src=''/></div></div>");
            $("#outerDiv").remove();
            $("body").append(cover);
            imgShow("#outerDiv", "#innerDiv", "#bigImg", _this,src);

        }
    }
    function imgShow(outerDiv, innerDiv, bigImg, _this,src) {
        //var src = _this.attr("src"); //获取当前点击的common-img元素中的src属性
        $(bigImg).attr("src", src); //设置#bigImg元素的src属性

        /*获取当前点击图片的真实大小，并显示弹出层及大图*/
        $("<img/>").attr("src", src).on('load',function () {
            var windowW = $(window).width(); //获取当前窗口宽度
            var windowH = $(window).height(); //获取当前窗口高度
            var realWidth = this.width; //获取图片真实宽度
            var realHeight = this.height; //获取图片真实高度
            var imgWidth, imgHeight;
            var scale = 0.8; //缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放

            if (realHeight > windowH * scale) { //判断图片高度
                imgHeight = windowH * scale; //如大于窗口高度，图片高度进行缩放
                imgWidth = imgHeight / realHeight * realWidth; //等比例缩放宽度
                if (imgWidth > windowW * scale) { //如宽度仍大于窗口宽度
                    imgWidth = windowW * scale; //再对宽度进行缩放
                }
            } else if (realWidth > windowW * scale) { //如图片高度合适，判断图片宽度
                imgWidth = windowW * scale; //如大于窗口宽度，图片宽度进行缩放
                imgHeight = imgWidth / realWidth * realHeight; //等比例缩放高度
            } else { //如果图片真实高度和宽度都符合要求，高宽不变
                imgWidth = realWidth;
                imgHeight = realHeight;
            }
            $(bigImg).css("width", imgWidth); //以最终的宽度对图片缩放

            var w = (windowW - imgWidth) / 2; //计算图片与窗口左边距
            var h = (windowH - imgHeight) / 2; //计算图片与窗口上边距
            $(innerDiv).css({ "top": h, "left": w }); //设置#innerDiv的top和left属性
            //console.log('****')
            $(outerDiv).fadeIn("fast"); //淡入显示#outerDiv
        });

        $(outerDiv).click(function () { //再次点击淡出消失弹出层
            $(this).fadeOut("fast");
        });
    }
    setTimeout(function () {
        createImgEventFullScreen();
    }, 1000)
</script>
<style>
.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body{
	width: 0px!important
}
.aplayer.aplayer-narrow .aplayer-body, .aplayer.aplayer-narrow .aplayer-pic {
	width: 0px!important
}
</style>
</body>
</html>